Struct PokeOption

Source
pub struct PokeOption<'mem> { /* private fields */ }
Expand description

Allows poking an option (setting Some/None)

Implementations§

Source§

impl<'mem> PokeOption<'mem>

Source

pub fn shape(&self) -> &'static Shape

Returns the shape of this option

Source

pub fn def(&self) -> OptionDef

Returns the option definition

Source

pub fn vtable(&self) -> &'static OptionVTable

Returns the option vtable

Source

pub fn replace_with_none(self) -> Self

Replace the current value with None

Source

pub fn replace_with_some<T>(self, value: T) -> Self

Replace the current value with Some

Source

pub fn replace_with_some_opaque(self, value: OpaqueConst<'mem>) -> Self

Replace the current value with some type-erased inner value.

Source

pub fn into_value(self) -> PokeValueUninit<'mem>

Get a reference to the underlying value

Source

pub fn build_in_place(self) -> Opaque<'mem>

Takes ownership of this PokeOption and returns the underlying data.

Source

pub fn build<T: Facet>(self, guard: Option<Guard>) -> Option<T>

Builds an Option<T> from the PokeOption, then deallocates the memory that this PokeOption was pointing to.

§Panics

This function will panic if:

  • The generic type parameter T does not match the shape that this PokeOption is building.

Auto Trait Implementations§

§

impl<'mem> Freeze for PokeOption<'mem>

§

impl<'mem> RefUnwindSafe for PokeOption<'mem>

§

impl<'mem> !Send for PokeOption<'mem>

§

impl<'mem> !Sync for PokeOption<'mem>

§

impl<'mem> Unpin for PokeOption<'mem>

§

impl<'mem> !UnwindSafe for PokeOption<'mem>

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.