[−][src]Struct another_option::Opt
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]
self,
default: D,
f: F
) -> U
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: Ord> Ord for Opt<T>
[src]
fn cmp(&self, other: &Opt<T>) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T> PartialEq<Opt<T>> for Opt<T> where
T: PartialEq,
[src]
T: PartialEq,
impl<T: PartialOrd> PartialOrd<Opt<T>> for Opt<T>
[src]
fn partial_cmp(&self, other: &Opt<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &Opt<T>) -> bool
[src]
fn le(&self, other: &Opt<T>) -> bool
[src]
fn gt(&self, other: &Opt<T>) -> bool
[src]
fn ge(&self, other: &Opt<T>) -> bool
[src]
impl<T> StructuralEq for Opt<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Opt<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Opt<T> where
T: Send,
T: Send,
impl<T> Sync for Opt<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Opt<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Opt<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,