The iteration traits and common implementation
InitOp
- A function used to initialize the elements of a sequenceBaseIter
Buildable
CopyableIter
CopyableNonstrictIter
CopyableOrderedIter
EqIter
ExtendedIter
Times
all
any
append
- Appending two generic sequencesbuild
build_sized_opt
contains
copy_seq
- Copies a generic sequence, possibly converting it to a different type of sequence.count
eachi
filter_to_vec
find
flat_map_to_vec
foldl
from_elem
- Creates and initializes a generic sequence with some elementfrom_fn
- Creates and initializes a generic sequence from a functionmap
- Apply a function to each element of an iterable and return the resultsmap_to_vec
max
min
position
repeat
to_vec
InitOp
type InitOp<T> = &fn(uint) -> T
A function used to initialize the elements of a sequence
BaseIter
each
fn each(blk: &fn(v: &A) -> bool)
size_hint
fn size_hint() -> Option<uint>
Buildable
build_sized
fn build_sized(size: uint, builder: &fn(push: &pure fn(A))) -> self
Builds a buildable sequence by calling a provided function with an argument function that pushes an element onto the back of the sequence. This version takes an initial size for the sequence.
CopyableIter
filter_to_vec
fn filter_to_vec(pred: &fn(&A) -> bool) -> ~[A]
to_vec
fn to_vec() -> ~[A]
find
fn find(p: &fn(&A) -> bool) -> Option<A>
CopyableNonstrictIter
each_val
fn each_val(f: &fn(A) -> bool)
CopyableOrderedIter
min
fn min() -> A
max
fn max() -> A
EqIter
contains
fn contains(x: &A) -> bool
count
fn count(x: &A) -> uint
ExtendedIter
eachi
fn eachi(blk: &fn(uint, v: &A) -> bool)
all
fn all(blk: &fn(&A) -> bool) -> bool
any
fn any(blk: &fn(&A) -> bool) -> bool
foldl
fn foldl<B>(b0: B, blk: &fn(&B, &A) -> B) -> B
position
fn position(f: &fn(&A) -> bool) -> Option<uint>
map_to_vec
fn map_to_vec<B>(op: &fn(&A) -> B) -> ~[B]
flat_map_to_vec
fn flat_map_to_vec<B, IB: BaseIter<B>>(op: &fn(&A) -> IB) -> ~[B]
Times
times
fn times(it: &fn() -> bool)
all
fn all<A, IA: BaseIter<A>>(self: &IA, blk: &fn(&A) -> bool) -> bool
any
fn any<A, IA: BaseIter<A>>(self: &IA, blk: &fn(&A) -> bool) -> bool
append
fn append<T: Copy, IT: BaseIter<T>, BT: Buildable<T>>(lhs: &IT, rhs: &IT) ->
BT
Appending two generic sequences
build
fn build<A, B: Buildable<A>>(builder: &fn(push: &pure fn(A))) -> B
Builds a sequence by calling a provided function with an argument function that pushes an element to the back of a sequence.
build_sized_opt
fn build_sized_opt<A,
B: Buildable<A>>(size: Option<uint>,
builder: &fn(push: &pure fn(A))) -> B
Builds a sequence by calling a provided function with an argument function that pushes an element to the back of a sequence. This version takes an initial size for the sequence.
contains
fn contains<A: Eq, IA: BaseIter<A>>(self: &IA, x: &A) -> bool
copy_seq
fn copy_seq<T: Copy, IT: BaseIter<T>, BT: Buildable<T>>(v: &IT) -> BT
Copies a generic sequence, possibly converting it to a different type of sequence.
count
fn count<A: Eq, IA: BaseIter<A>>(self: &IA, x: &A) -> uint
eachi
fn eachi<A, IA: BaseIter<A>>(self: &IA, blk: &fn(uint, &A) -> bool)
filter_to_vec
fn filter_to_vec<A: Copy, IA: BaseIter<A>>(self: &IA, prd: &fn(&A) -> bool) ->
~[A]
find
fn find<A: Copy, IA: BaseIter<A>>(self: &IA, f: &fn(&A) -> bool) -> Option<A>
flat_map_to_vec
fn flat_map_to_vec<A, B, IA: BaseIter<A>,
IB: BaseIter<B>>(self: &IA, op: &fn(&A) -> IB) -> ~[B]
foldl
fn foldl<A, B, IA: BaseIter<A>>(self: &IA, b0: B, blk: &fn(&B, &A) -> B) -> B
from_elem
fn from_elem<T: Copy, BT: Buildable<T>>(n_elts: uint, t: T) -> BT
Creates and initializes a generic sequence with some element
Creates an immutable vector of size n_elts
and initializes the elements to the value t
.
from_fn
fn from_fn<T, BT: Buildable<T>>(n_elts: uint, op: InitOp<T>) -> BT
Creates and initializes a generic sequence from a function
Creates a generic sequence of size n_elts
and initializes the elements to the value returned by the function op
.
map
fn map<T, IT: BaseIter<T>, U, BU: Buildable<U>>(v: &IT, f: &fn(&T) -> U) -> BU
Apply a function to each element of an iterable and return the results
map_to_vec
fn map_to_vec<A, B, IA: BaseIter<A>>(self: &IA, op: &fn(&A) -> B) -> ~[B]
max
fn max<A: Copy Ord, IA: BaseIter<A>>(self: &IA) -> A
min
fn min<A: Copy Ord, IA: BaseIter<A>>(self: &IA) -> A
position
fn position<A, IA: BaseIter<A>>(self: &IA, f: &fn(&A) -> bool) -> Option<uint>
repeat
fn repeat(times: uint, blk: &fn() -> bool)
to_vec
fn to_vec<A: Copy, IA: BaseIter<A>>(self: &IA) -> ~[A]