pub struct RedoubtOption<T>{ /* private fields */ }Expand description
An optional value wrapper with automatic zeroization.
Implementations§
Source§impl<T> RedoubtOption<T>
impl<T> RedoubtOption<T>
Sourcepub fn as_ref(&self) -> Result<&T, RedoubtOptionError>
pub fn as_ref(&self) -> Result<&T, RedoubtOptionError>
Returns a reference to the inner value, or an error if None.
Sourcepub fn as_mut(&mut self) -> Result<&mut T, RedoubtOptionError>
pub fn as_mut(&mut self) -> Result<&mut T, RedoubtOptionError>
Returns a mutable reference to the inner value, or an error if None.
Sourcepub fn replace(&mut self, value: &mut T)where
T: Default,
pub fn replace(&mut self, value: &mut T)where
T: Default,
Replaces the inner value with a new one, zeroizing both the old value and the source.
Sourcepub fn take(&mut self) -> Result<T, RedoubtOptionError>
pub fn take(&mut self) -> Result<T, RedoubtOptionError>
Takes the value out of the option, leaving None in its place.
Sourcepub fn as_mut_option(&mut self) -> &mut Option<T>
pub fn as_mut_option(&mut self) -> &mut Option<T>
Returns a mutable reference to the inner Option<T>.
Trait Implementations§
Source§impl<T> AssertZeroizeOnDrop for RedoubtOption<T>
impl<T> AssertZeroizeOnDrop for RedoubtOption<T>
Source§fn clone_sentinel(&self) -> ZeroizeOnDropSentinel
fn clone_sentinel(&self) -> ZeroizeOnDropSentinel
Clones the internal
ZeroizeOnDropSentinel for verification. Read moreSource§fn assert_zeroize_on_drop(self)
fn assert_zeroize_on_drop(self)
Asserts that zeroization happens when this value is dropped. Read more
Source§impl<T> Default for RedoubtOption<T>
impl<T> Default for RedoubtOption<T>
Source§fn default() -> RedoubtOption<T>
fn default() -> RedoubtOption<T>
Returns the “default value” for a type. Read more
Source§impl<T> FastZeroizable for RedoubtOption<T>
impl<T> FastZeroizable for RedoubtOption<T>
Source§fn fast_zeroize(&mut self)
fn fast_zeroize(&mut self)
Zeroizes the value in place. Read more
Source§impl<T> ZeroizationProbe for RedoubtOption<T>
impl<T> ZeroizationProbe for RedoubtOption<T>
Source§fn is_zeroized(&self) -> bool
fn is_zeroized(&self) -> bool
Returns
true if the value is zeroized (all bytes are 0). Read moreSource§impl<T> ZeroizeMetadata for RedoubtOption<T>
impl<T> ZeroizeMetadata for RedoubtOption<T>
Source§const CAN_BE_BULK_ZEROIZED: bool = false
const CAN_BE_BULK_ZEROIZED: bool = false
Whether this type can be bulk-zeroized with memset. Read more
Auto Trait Implementations§
impl<T> Freeze for RedoubtOption<T>where
T: Freeze,
impl<T> RefUnwindSafe for RedoubtOption<T>where
T: RefUnwindSafe,
impl<T> Send for RedoubtOption<T>where
T: Send,
impl<T> Sync for RedoubtOption<T>where
T: Sync,
impl<T> Unpin for RedoubtOption<T>where
T: Unpin,
impl<T> UnwindSafe for RedoubtOption<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