Struct PokeOptionUninit

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

Allows initializing an uninitialized option

Implementations§

Source§

impl<'mem> PokeOptionUninit<'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 into_value(self) -> PokeValueUninit<'mem>

Get a reference to the underlying PokeValue

Source

pub unsafe fn init_none(self) -> PokeOption<'mem>

Initialize the option as None

§Safety

Caller must ensure that all safety requirements for initializing this option are met.

Source

pub unsafe fn write<'a>(self, value: OpaqueConst<'a>) -> PokeOption<'mem>

Initialize the option as Some, taking ownership of the given value

§Safety

Caller must ensure that all safety requirements for initializing this option are met and that the value type matches what the option expects.

Caller must free the memory pointed to by value after the option is initialized, but must not drop it in place — it’s been copied bitwise into the option.

Source

pub unsafe fn put<T>(self, value: T) -> PokeOption<'mem>

Initialize the option by providing a value of type T

§Safety

Caller must ensure that T matches the expected type of the option and that all safety requirements for initializing this option are met.

Auto Trait Implementations§

§

impl<'mem> Freeze for PokeOptionUninit<'mem>

§

impl<'mem> RefUnwindSafe for PokeOptionUninit<'mem>

§

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

§

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

§

impl<'mem> Unpin for PokeOptionUninit<'mem>

§

impl<'mem> !UnwindSafe for PokeOptionUninit<'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.