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>
impl<'mem> PokeValue<'mem>
Sourcepub unsafe fn unchecked_new(data: Opaque<'mem>, shape: &'static Shape) -> Self
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.
Sourcepub fn into_value(self) -> Self
pub fn into_value(self) -> Self
Coerce back into a PokeValue
Sourcepub fn typed<T: Facet>(self) -> Result<TypedPokeValue<'mem, T>, Self>
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.
Sourcepub unsafe fn data(&mut self) -> Opaque<'mem>
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.
Sourcepub fn replace<'src, T>(self, value: T) -> Opaque<'mem>where
T: Facet + 'src,
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.
Sourcepub fn debug_fmt(&self, f: &mut Formatter<'_>) -> Result
pub fn debug_fmt(&self, f: &mut Formatter<'_>) -> Result
Format the value using its Debug implementation
Sourcepub fn display_fmt(&self, f: &mut Formatter<'_>) -> Result
pub fn display_fmt(&self, f: &mut Formatter<'_>) -> Result
Format the value using its Display implementation
Sourcepub fn scalar_type(&self) -> Option<ScalarType>
pub fn scalar_type(&self) -> Option<ScalarType>
Get the scalar type if set.