Skip to main content

LikelyOption

Trait LikelyOption 

Source
pub trait LikelyOption: Sized {
    type Value;

Show 24 methods // Required methods fn and_likely<U>(self, res: Option<U>) -> Option<U>; fn and_unlikely<U>(self, res: Option<U>) -> Option<U>; fn and_then_likely<U, F: FnOnce(Self::Value) -> Option<U>>( self, f: F, ) -> Option<U>; fn and_then_unlikely<U, F: FnOnce(Self::Value) -> Option<U>>( self, f: F, ) -> Option<U>; fn get_or_insert_likely(&mut self, value: Self::Value) -> &mut Self::Value; fn get_or_insert_unlikely(&mut self, value: Self::Value) -> &mut Self::Value; fn get_or_insert_with_likely<F: FnOnce() -> Self::Value>( &mut self, f: F, ) -> &mut Self::Value; fn get_or_insert_with_unlikely<F: FnOnce() -> Self::Value>( &mut self, f: F, ) -> &mut Self::Value; fn filter_likely<P: FnOnce(&Self::Value) -> bool>( self, predicate: P, ) -> Self; fn filter_unlikely<P: FnOnce(&Self::Value) -> bool>( self, predicate: P, ) -> Self; fn map_likely<U, F: FnOnce(Self::Value) -> U>(self, f: F) -> Option<U>; fn map_unlikely<U, F: FnOnce(Self::Value) -> U>(self, f: F) -> Option<U>; fn map_or_likely<U, F: FnOnce(Self::Value) -> U>( self, default: U, f: F, ) -> U; fn map_or_unlikely<U, F: FnOnce(Self::Value) -> U>( self, default: U, f: F, ) -> U; fn map_or_else_likely<U, D: FnOnce() -> U, F: FnOnce(Self::Value) -> U>( self, default: D, f: F, ) -> U; fn map_or_else_unlikely<U, D: FnOnce() -> U, F: FnOnce(Self::Value) -> U>( self, default: D, f: F, ) -> U; fn or_likely(self, b: Self) -> Self; fn or_unlikely(self, b: Self) -> Self; fn or_else_likely<F: FnOnce() -> Self>(self, b: F) -> Self; fn or_else_unlikely<F: FnOnce() -> Self>(self, b: F) -> Self; fn unwrap_or_likely(self, d: Self::Value) -> Self::Value; fn unwrap_or_unlikely(self, d: Self::Value) -> Self::Value; fn unwrap_or_else_likely<F: FnOnce() -> Self::Value>( self, b: F, ) -> Self::Value; fn unwrap_or_else_unlikely<F: FnOnce() -> Self::Value>( self, b: F, ) -> Self::Value;
}
Expand description

Likely trait for Options

likely method suffix means likely Some.

Required Associated Types§

Required Methods§

Source

fn and_likely<U>(self, res: Option<U>) -> Option<U>

Source

fn and_unlikely<U>(self, res: Option<U>) -> Option<U>

Source

fn and_then_likely<U, F: FnOnce(Self::Value) -> Option<U>>( self, f: F, ) -> Option<U>

Source

fn and_then_unlikely<U, F: FnOnce(Self::Value) -> Option<U>>( self, f: F, ) -> Option<U>

Source

fn get_or_insert_likely(&mut self, value: Self::Value) -> &mut Self::Value

Source

fn get_or_insert_unlikely(&mut self, value: Self::Value) -> &mut Self::Value

Source

fn get_or_insert_with_likely<F: FnOnce() -> Self::Value>( &mut self, f: F, ) -> &mut Self::Value

Source

fn get_or_insert_with_unlikely<F: FnOnce() -> Self::Value>( &mut self, f: F, ) -> &mut Self::Value

Source

fn filter_likely<P: FnOnce(&Self::Value) -> bool>(self, predicate: P) -> Self

Source

fn filter_unlikely<P: FnOnce(&Self::Value) -> bool>(self, predicate: P) -> Self

Source

fn map_likely<U, F: FnOnce(Self::Value) -> U>(self, f: F) -> Option<U>

Source

fn map_unlikely<U, F: FnOnce(Self::Value) -> U>(self, f: F) -> Option<U>

Source

fn map_or_likely<U, F: FnOnce(Self::Value) -> U>(self, default: U, f: F) -> U

Source

fn map_or_unlikely<U, F: FnOnce(Self::Value) -> U>(self, default: U, f: F) -> U

Source

fn map_or_else_likely<U, D: FnOnce() -> U, F: FnOnce(Self::Value) -> U>( self, default: D, f: F, ) -> U

Source

fn map_or_else_unlikely<U, D: FnOnce() -> U, F: FnOnce(Self::Value) -> U>( self, default: D, f: F, ) -> U

Source

fn or_likely(self, b: Self) -> Self

Source

fn or_unlikely(self, b: Self) -> Self

Source

fn or_else_likely<F: FnOnce() -> Self>(self, b: F) -> Self

Source

fn or_else_unlikely<F: FnOnce() -> Self>(self, b: F) -> Self

Source

fn unwrap_or_likely(self, d: Self::Value) -> Self::Value

Source

fn unwrap_or_unlikely(self, d: Self::Value) -> Self::Value

Source

fn unwrap_or_else_likely<F: FnOnce() -> Self::Value>(self, b: F) -> Self::Value

Source

fn unwrap_or_else_unlikely<F: FnOnce() -> Self::Value>( self, b: F, ) -> Self::Value

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> LikelyOption for Option<T>

Source§

type Value = T

Source§

fn and_likely<U>(self, res: Option<U>) -> Option<U>

Source§

fn and_unlikely<U>(self, res: Option<U>) -> Option<U>

Source§

fn and_then_likely<U, F: FnOnce(Self::Value) -> Option<U>>( self, f: F, ) -> Option<U>

Source§

fn and_then_unlikely<U, F: FnOnce(Self::Value) -> Option<U>>( self, f: F, ) -> Option<U>

Source§

fn filter_likely<P: FnOnce(&T) -> bool>(self, predicate: P) -> Option<T>

Source§

fn filter_unlikely<P: FnOnce(&T) -> bool>(self, predicate: P) -> Option<T>

Source§

fn get_or_insert_likely(&mut self, value: Self::Value) -> &mut Self::Value

Source§

fn get_or_insert_unlikely(&mut self, value: Self::Value) -> &mut Self::Value

Source§

fn get_or_insert_with_likely<F: FnOnce() -> T>( &mut self, f: F, ) -> &mut Self::Value

Source§

fn get_or_insert_with_unlikely<F: FnOnce() -> T>( &mut self, f: F, ) -> &mut Self::Value

Source§

fn map_likely<U, F: FnOnce(Self::Value) -> U>(self, f: F) -> Option<U>

Source§

fn map_unlikely<U, F: FnOnce(Self::Value) -> U>(self, f: F) -> Option<U>

Source§

fn map_or_likely<U, F: FnOnce(Self::Value) -> U>(self, default: U, f: F) -> U

Source§

fn map_or_unlikely<U, F: FnOnce(Self::Value) -> U>(self, default: U, f: F) -> U

Source§

fn map_or_else_likely<U, D: FnOnce() -> U, F: FnOnce(Self::Value) -> U>( self, default: D, f: F, ) -> U

Source§

fn map_or_else_unlikely<U, D: FnOnce() -> U, F: FnOnce(Self::Value) -> U>( self, default: D, f: F, ) -> U

Source§

fn or_likely(self, b: Self) -> Self

Source§

fn or_unlikely(self, b: Self) -> Self

Source§

fn or_else_likely<F: FnOnce() -> Self>(self, b: F) -> Self

Source§

fn or_else_unlikely<F: FnOnce() -> Self>(self, b: F) -> Self

Source§

fn unwrap_or_likely(self, d: Self::Value) -> Self::Value

Source§

fn unwrap_or_unlikely(self, d: Self::Value) -> Self::Value

Source§

fn unwrap_or_else_likely<F: FnOnce() -> Self::Value>(self, b: F) -> Self::Value

Source§

fn unwrap_or_else_unlikely<F: FnOnce() -> Self::Value>( self, b: F, ) -> Self::Value

Implementors§