pub struct ControlledOption<T>where
T: Niche,{ /* private fields */ }
Expand description
An Option
type where you have control over the in-memory representation of the None
and
Some
variants. See the module-level documentation for more information.
Implementations§
Source§impl<T> ControlledOption<T>where
T: Niche,
impl<T> ControlledOption<T>where
T: Niche,
Sourcepub fn none() -> ControlledOption<T>
pub fn none() -> ControlledOption<T>
Creates a new None
instance for this option.
Sourcepub fn some(value: T) -> ControlledOption<T>
pub fn some(value: T) -> ControlledOption<T>
Creates a new Some
instance for this option.
Sourcepub fn from_option(value: Option<T>) -> ControlledOption<T>
pub fn from_option(value: Option<T>) -> ControlledOption<T>
Transforms an Option
into a ControlledOption
.
Sourcepub fn into_option(self) -> Option<T>
pub fn into_option(self) -> Option<T>
Transforms a ControlledOption
into an Option
. This gives you access to all of the
usual assortment of useful methods that you expect from an Option
.
Trait Implementations§
Source§impl<T> Clone for ControlledOption<T>
impl<T> Clone for ControlledOption<T>
Source§impl<T> Debug for ControlledOption<T>
impl<T> Debug for ControlledOption<T>
Source§impl<T> Default for ControlledOption<T>where
T: Niche,
impl<T> Default for ControlledOption<T>where
T: Niche,
Source§fn default() -> ControlledOption<T>
fn default() -> ControlledOption<T>
Returns the “default value” for a type. Read more
Source§impl<T> From<Option<T>> for ControlledOption<T>where
T: Niche,
impl<T> From<Option<T>> for ControlledOption<T>where
T: Niche,
Source§fn from(value: Option<T>) -> ControlledOption<T>
fn from(value: Option<T>) -> ControlledOption<T>
Converts to this type from the input type.
Source§impl<T> From<T> for ControlledOption<T>where
T: Niche,
impl<T> From<T> for ControlledOption<T>where
T: Niche,
Source§fn from(value: T) -> ControlledOption<T>
fn from(value: T) -> ControlledOption<T>
Converts to this type from the input type.
Source§impl<T> Hash for ControlledOption<T>
impl<T> Hash for ControlledOption<T>
Source§impl<T> PartialEq for ControlledOption<T>
impl<T> PartialEq for ControlledOption<T>
Source§impl<T> PartialOrd for ControlledOption<T>
impl<T> PartialOrd for ControlledOption<T>
impl<T> Copy for ControlledOption<T>
impl<T> Eq for ControlledOption<T>
Auto Trait Implementations§
impl<T> Freeze for ControlledOption<T>
impl<T> RefUnwindSafe for ControlledOption<T>
impl<T> Send for ControlledOption<T>
impl<T> Sync for ControlledOption<T>
impl<T> Unpin for ControlledOption<T>
impl<T> UnwindSafe for ControlledOption<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more