Struct alo::ALO
[−]
[src]
pub struct ALO<T>(_, _);
ALO means At Least One. It cointains at least one item. If there is only one item, ALO does not heap allocate. If there is more than one items, ALO does heap allocate.
Methods
impl<T> ALO<T>
[src]
fn with_item(item: T) -> ALO<T>
fn add(&mut self, item: T)
fn get(&self, index: usize) -> Option<&T>
fn remove(&mut self, index: usize) -> T
Remove item in given index.
Panics
Panics if ALO has only one item. Panics if index is out of bounds.
fn len(&self) -> usize
fn iter<'a>(&'a self) -> Iter<'a, T>
Trait Implementations
impl<T: Clone> Clone for ALO<T>
[src]
fn clone(&self) -> ALO<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<T> Debug for ALO<T> where
T: Debug,
[src]
T: Debug,
impl<T> Display for ALO<T> where
T: Display,
[src]
T: Display,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
This prints like below "ALO ( "String", and more 9 items )
impl<A, B> PartialEq<ALO<B>> for ALO<A> where
A: PartialEq<B>,
[src]
A: PartialEq<B>,
fn eq(&self, other: &ALO<B>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<T> Eq for ALO<T> where
T: Eq,
[src]
T: Eq,
impl<T> PartialOrd for ALO<T> where
T: PartialOrd<T>,
[src]
T: PartialOrd<T>,
fn partial_cmp(&self, other: &ALO<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T> Ord for ALO<T> where
T: Ord,
[src]
T: Ord,