Trait fera_optional::Optional
[−]
[src]
pub trait Optional<T>: Default + From<T> { fn to_option_ref(&self) -> Option<&T>; fn to_option_mut(&mut self) -> Option<&mut T>; fn into_option(self) -> Option<T>; }
A trait that represents an optional value.
This is a complement to std::option::Option
that allows implementations to choose how to
represent Some
and None
.
Required Methods
fn to_option_ref(&self) -> Option<&T>
Returns an Option<&T>
that is equivalent to this Optional
.
fn to_option_mut(&mut self) -> Option<&mut T>
Returns an Option<&mut T>
that is equivalent to this Optional
.
fn into_option(self) -> Option<T>
Converts this Optional
to the equivalent Option
.
Implementations on Foreign Types
impl<T> Optional<T> for Option<T>
[src]
fn to_option_ref(&self) -> Option<&T>
[src]
fn to_option_mut(&mut self) -> Option<&mut T>
[src]
fn into_option(self) -> Option<T>
[src]
Implementors
impl<T: Eq, B: BuildNone<T>> Optional<T> for Optioned<T, B>
impl Optional<bool> for OptionalBool