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§
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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".