pub struct OOption<T>{
pub value: T,
pub is_some: bool,
}Expand description
An alternative option implementation that is easier to use in constant-time algorithms. This type is designed to be used in scenarios where you need to conditionally move between two values without leaking information about which value is present.
Fields§
§value: TThe underlying value of the option.
is_some: boolA boolean flag indicating whether the option contains a value.
Implementations§
Trait Implementations§
Source§impl<T> Cmov for OOption<T>
impl<T> Cmov for OOption<T>
Source§impl<T> Ord for OOption<T>
impl<T> Ord for OOption<T>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T> PartialOrd for OOption<T>
impl<T> PartialOrd for OOption<T>
impl<T> Copy for OOption<T>
impl<T> Eq for OOption<T>
impl<T> StructuralPartialEq for OOption<T>
Auto Trait Implementations§
impl<T> Freeze for OOption<T>where
T: Freeze,
impl<T> RefUnwindSafe for OOption<T>where
T: RefUnwindSafe,
impl<T> Send for OOption<T>where
T: Send,
impl<T> Sync for OOption<T>where
T: Sync,
impl<T> Unpin for OOption<T>where
T: Unpin,
impl<T> UnwindSafe for OOption<T>where
T: UnwindSafe,
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