Struct idcontain::OptionId
[−]
[src]
pub struct OptionId<T>(_);
An Option
-like container of Id<T>
that takes up no additional space.
Internally, None
is represented as Id::invalid()
. An OptionId<T>
implements conversion to
and from an Option<Id<T>>
, but it also forwards all the methods that Option<T>
does, for
convenience.
Methods
impl<T> OptionId<T>
[src]
fn some(id: Id<T>) -> Self
[src]
fn none() -> Self
[src]
fn into_option(self) -> Option<Id<T>>
[src]
fn is_none(&self) -> bool
[src]
fn is_some(&self) -> bool
[src]
fn as_ref(&self) -> Option<&Id<T>>
[src]
fn as_mut(&mut self) -> Option<&mut Id<T>>
[src]
fn expect(self, msg: &str) -> Id<T>
[src]
fn unwrap(self) -> Id<T>
[src]
fn unwrap_or(self, def: Id<T>) -> Id<T>
[src]
fn unwrap_or_else<F>(self, f: F) -> Id<T> where
F: FnOnce() -> Id<T>,
[src]
F: FnOnce() -> Id<T>,
fn map<U, F>(self, f: F) -> Option<U> where
F: FnOnce(Id<T>) -> U,
[src]
F: FnOnce(Id<T>) -> U,
fn map_or<U, F>(self, default: U, f: F) -> U where
F: FnOnce(Id<T>) -> U,
[src]
F: FnOnce(Id<T>) -> U,
fn map_or_else<U, D, F>(self, default: D, f: F) -> U where
D: FnOnce() -> U,
F: FnOnce(Id<T>) -> U,
[src]
D: FnOnce() -> U,
F: FnOnce(Id<T>) -> U,
fn ok_or<E>(self, err: E) -> Result<Id<T>, E>
[src]
fn ok_or_else<E, F>(self, err: F) -> Result<Id<T>, E> where
F: FnOnce() -> E,
[src]
F: FnOnce() -> E,
fn iter(&self) -> OptionIntoIter<&Id<T>>
[src]
fn iter_mut(&mut self) -> OptionIntoIter<&mut Id<T>>
[src]
fn and<U, O>(self, optb: O) -> Option<U> where
O: Into<Option<U>>,
[src]
O: Into<Option<U>>,
fn and_then<U, O, F>(self, f: F) -> Option<U> where
F: FnOnce(Id<T>) -> O,
O: Into<Option<U>>,
[src]
F: FnOnce(Id<T>) -> O,
O: Into<Option<U>>,
fn or<O>(self, optb: O) -> Option<Id<T>> where
O: Into<Option<Id<T>>>,
[src]
O: Into<Option<Id<T>>>,
fn or_else<F, O>(self, f: F) -> Option<Id<T>> where
F: FnOnce() -> O,
O: Into<Option<Id<T>>>,
[src]
F: FnOnce() -> O,
O: Into<Option<Id<T>>>,
fn take(&mut self) -> Self
[src]
Trait Implementations
impl<T> Into<Option<Id<T>>> for OptionId<T>
[src]
impl<T> From<Option<Id<T>>> for OptionId<T>
[src]
impl<T> Debug for OptionId<T>
[src]
fn fmt(&self, formatter: &mut Formatter) -> FmtResult
[src]
Formats the value using the given formatter.
impl<T> Hash for OptionId<T>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T> PartialOrd for OptionId<T>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
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[src]
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[src]
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[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T> PartialEq for OptionId<T>
[src]
fn eq(&self, other: &Self) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Self) -> bool
[src]
This method tests for !=
.
impl<T> Ord for OptionId<T>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
[src]
ord_max_min
)Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
[src]
ord_max_min
)Compares and returns the minimum of two values. Read more
impl<T> Clone for OptionId<T>
[src]
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more