[][src]Struct another_option::Opt

pub struct Opt<T> { /* fields omitted */ }

Methods

impl<T> Opt<T>[src]

pub fn none(value: T) -> Opt<T>[src]

Construct an option with no value.

Note: perhaps unexpectedly, this function accepts a value argument. This is necessary given the underlying data structure.

pub fn some(value: T) -> Opt<T>[src]

Construct an option with 'some' value.

impl<T> Opt<T>[src]

pub fn is_none(&self) -> bool[src]

pub fn is_some(&self) -> bool[src]

pub fn set_none(&mut self)[src]

pub fn set_some(&mut self)[src]

pub fn set_some_value(&mut self, value: T)[src]

pub fn as_ref(&self) -> Opt<&T>[src]

Converts from &Opt<T> to Opt<&T>.

pub fn as_mut(&mut self) -> Opt<&mut T>[src]

Converts from &mut Opt<T> to Opt<&mut T>.

pub fn expect(self, msg: &str) -> T[src]

pub fn unwrap(self) -> T[src]

pub fn unwrap_or(self, default: T) -> T[src]

pub fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T[src]

pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Opt<U>[src]

Applies the function f to the value; regardless if Opt<T> is empty or not. Does not modify the 'emptiness' of the option. (Note: This behavior, though consistent, may seem strange at first.)

pub fn map_in_place<F: FnOnce(&mut T)>(&mut self, f: F)[src]

pub fn map_or<U, F: FnOnce(T) -> U>(self, default: U, f: F) -> U[src]

pub fn map_or_else<U, D: FnOnce() -> U, F: FnOnce(T) -> U>(
    self,
    default: D,
    f: F
) -> U
[src]

pub fn ok_or<E>(self, err: E) -> Result<T, E>[src]

pub fn ok_or_else<E, F: FnOnce() -> E>(self, err: F) -> Result<T, E>[src]

Trait Implementations

impl<T: Clone> Clone for Opt<T>[src]

impl<T: Copy> Copy for Opt<T>[src]

impl<T: Debug> Debug for Opt<T>[src]

impl<T: Eq> Eq for Opt<T>[src]

impl<T: Hash> Hash for Opt<T>[src]

impl<T: Ord> Ord for Opt<T>[src]

impl<T> PartialEq<Opt<T>> for Opt<T> where
    T: PartialEq
[src]

impl<T: PartialOrd> PartialOrd<Opt<T>> for Opt<T>[src]

impl<T> StructuralEq for Opt<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Opt<T> where
    T: RefUnwindSafe

impl<T> Send for Opt<T> where
    T: Send

impl<T> Sync for Opt<T> where
    T: Sync

impl<T> Unpin for Opt<T> where
    T: Unpin

impl<T> UnwindSafe for Opt<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.