Struct PokeValueUninit

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

Lets you write to a value (implements write-only ValueVTable proxies)

Implementations§

Source§

impl<'mem> PokeValueUninit<'mem>

Source

pub fn into_value(self) -> Self

Coerce back into a PokeValue

Source

pub fn typed<T: Facet>(self) -> Result<TypedPokeValueUninit<'mem, T>, Self>

Converts to a type-checked TypedPokeValue<T> if the shape matches type T

Returns None if the shape doesn’t match the type T.

Source

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

Shape getter

Source

pub unsafe fn data(&mut self) -> OpaqueUninit<'mem>

Exposes the internal data buffer as a mutable reference

§Safety

The caller must ensure that they don’t violate any invariants of the underlying type.

Source

pub fn try_from<'src>( self, source: OpaqueConst<'src>, ) -> Result<Opaque<'mem>, (Self, TryFromError)>

Attempts to convert a value from another type into this one

Returns Ok(Opaque) if the conversion was successful, Err((Self, TryFromError)) otherwise.

Source

pub fn parse(self, s: &str) -> Result<Opaque<'mem>, Self>

Attempts to parse a string into this value

Returns Ok(Opaque) if parsing was successful, Err(Self) otherwise.

Source

pub fn put<'src, T>(self, value: T) -> Opaque<'mem>
where T: Facet + 'src,

Place a value in the space provided. See also Self::typed, which is panic-free.

This function places a value of type T into the destination space, checking that T exactly matches the expected shape.

Source

pub fn default_in_place(self) -> Result<Opaque<'mem>, Self>

Attempts to set the value to its default

Returns Ok(Opaque) if setting to default was successful, Err(Self) otherwise.

Source

pub fn clone_from<'src>(self, source: Peek<'src>) -> Result<Peek<'mem>, Self>

Attempts to clone source into this value

Returns Ok(Peek) if cloning was successful, Err(Self) otherwise.

Source

pub fn scalar_type(&self) -> Option<ScalarType>

Get the scalar type if set.

Trait Implementations§

Source§

impl Debug for PokeValueUninit<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'mem> Freeze for PokeValueUninit<'mem>

§

impl<'mem> RefUnwindSafe for PokeValueUninit<'mem>

§

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

§

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

§

impl<'mem> Unpin for PokeValueUninit<'mem>

§

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