RedoubtOption

Struct RedoubtOption 

Source
pub struct RedoubtOption<T>{ /* private fields */ }
Expand description

An optional value wrapper with automatic zeroization.

Implementations§

Source§

impl<T> RedoubtOption<T>

Source

pub fn as_ref(&self) -> Result<&T, RedoubtOptionError>

Returns a reference to the inner value, or an error if None.

Source

pub fn as_mut(&mut self) -> Result<&mut T, RedoubtOptionError>

Returns a mutable reference to the inner value, or an error if None.

Source

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.

Source

pub fn take(&mut self) -> Result<T, RedoubtOptionError>

Takes the value out of the option, leaving None in its place.

Source

pub fn is_some(&self) -> bool

Returns true if the option contains a value.

Source

pub fn is_none(&self) -> bool

Returns true if the option is None.

Source

pub fn as_option(&self) -> &Option<T>

Returns a reference to the inner Option<T>.

Source

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>

Source§

fn clone_sentinel(&self) -> ZeroizeOnDropSentinel

Clones the internal ZeroizeOnDropSentinel for verification. Read more
Source§

fn assert_zeroize_on_drop(self)

Asserts that zeroization happens when this value is dropped. Read more
Source§

impl<T> Default for RedoubtOption<T>

Source§

fn default() -> RedoubtOption<T>

Returns the “default value” for a type. Read more
Source§

impl<T> FastZeroizable for RedoubtOption<T>

Source§

fn fast_zeroize(&mut self)

Zeroizes the value in place. Read more
Source§

impl<T> ZeroizationProbe for RedoubtOption<T>

Source§

fn is_zeroized(&self) -> bool

Returns true if the value is zeroized (all bytes are 0). Read more
Source§

impl<T> ZeroizeMetadata for RedoubtOption<T>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> FastZeroize for T