Struct PokeValue

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

Lets you modify an initialized value (implements read-write ValueVTable proxies)

Implementations§

Source§

impl<'mem> PokeValue<'mem>

Source

pub unsafe fn unchecked_new(data: Opaque<'mem>, shape: &'static Shape) -> Self

Creates a value write-proxy from its essential components

§Safety

The data must be a valid, initialized instance of the type described by shape.

Source

pub fn into_value(self) -> Self

Coerce back into a PokeValue

Source

pub fn typed<T: Facet>(self) -> Result<TypedPokeValue<'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 fn as_peek(&self) -> Peek<'_>

Gets a read-only view of the value

Source

pub unsafe fn data(&mut self) -> Opaque<'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 replace<'src, T>(self, value: T) -> Opaque<'mem>
where T: Facet + 'src,

Replace the current value with a new one of the same type

This function replaces the existing value with a new one of type T, checking that T exactly matches the expected shape.

Source

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

Format the value using its Debug implementation

Source

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

Format the value using its Display implementation

Source

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

Get the scalar type if set.

Trait Implementations§

Source§

impl Debug for PokeValue<'_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'mem> Freeze for PokeValue<'mem>

§

impl<'mem> RefUnwindSafe for PokeValue<'mem>

§

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

§

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

§

impl<'mem> Unpin for PokeValue<'mem>

§

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