extra: Rename deque::Deque to ringbuf::RingBuf and impl trait Deque
Let RingBuf have a logical name for a concrete type, and Deque is used for the Deque trait (implemented by RingBuf and dlist).
This commit is contained in:
parent
6a95e49fc5
commit
7052371e39
5 changed files with 239 additions and 215 deletions
|
|
@ -19,7 +19,8 @@ An implementation of the Graph500 Breadth First Search problem in Rust.
|
|||
extern mod extra;
|
||||
use extra::arc;
|
||||
use extra::time;
|
||||
use extra::deque::Deque;
|
||||
use extra::ringbuf::RingBuf;
|
||||
use extra::container::Deque;
|
||||
use extra::par;
|
||||
use std::hashmap::HashSet;
|
||||
use std::num::abs;
|
||||
|
|
@ -133,18 +134,18 @@ fn bfs(graph: graph, key: node_id) -> bfs_result {
|
|||
let mut marks : ~[node_id]
|
||||
= vec::from_elem(graph.len(), -1i64);
|
||||
|
||||
let mut q = Deque::new();
|
||||
let mut q = RingBuf::new();
|
||||
|
||||
q.add_back(key);
|
||||
q.push_back(key);
|
||||
marks[key] = key;
|
||||
|
||||
while !q.is_empty() {
|
||||
let t = q.pop_front();
|
||||
let t = q.pop_front().unwrap();
|
||||
|
||||
do graph[t].iter().advance |k| {
|
||||
if marks[*k] == -1i64 {
|
||||
marks[*k] = t;
|
||||
q.add_back(*k);
|
||||
q.push_back(*k);
|
||||
}
|
||||
true
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,9 +11,10 @@
|
|||
// except according to those terms.
|
||||
|
||||
extern mod extra;
|
||||
use extra::deque::Deque;
|
||||
use extra::ringbuf::RingBuf;
|
||||
use extra::container::Deque;
|
||||
|
||||
pub fn main() {
|
||||
let mut q = Deque::new();
|
||||
q.add_back(10);
|
||||
let mut q = RingBuf::new();
|
||||
q.push_back(10);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue