pub struct PokeResult<'mem, 'facet> { /* private fields */ }Expand description
Lets you mutate a result (implements mutable result operations)
Implementations§
Source§impl<'mem, 'facet> PokeResult<'mem, 'facet>
impl<'mem, 'facet> PokeResult<'mem, 'facet>
Sourcepub const unsafe fn new(value: Poke<'mem, 'facet>, def: ResultDef) -> Self
pub const unsafe fn new(value: Poke<'mem, 'facet>, def: ResultDef) -> Self
Creates a new poke result
§Safety
The caller must ensure that def contains valid vtable function pointers that
correctly implement the result operations for the actual type, and that the
ok/err types match def.t() / def.e().
Sourcepub const fn vtable(&self) -> &'static ResultVTable
pub const fn vtable(&self) -> &'static ResultVTable
Returns the result vtable
Sourcepub fn ok(&self) -> Option<Peek<'_, 'facet>>
pub fn ok(&self) -> Option<Peek<'_, 'facet>>
Returns the Ok value as a read-only Peek if the result is Ok, None otherwise.
Sourcepub fn err(&self) -> Option<Peek<'_, 'facet>>
pub fn err(&self) -> Option<Peek<'_, 'facet>>
Returns the Err value as a read-only Peek if the result is Err, None otherwise.
Sourcepub fn ok_mut(&mut self) -> Option<Poke<'_, 'facet>>
pub fn ok_mut(&mut self) -> Option<Poke<'_, 'facet>>
Returns the Ok value as a mutable Poke if the result is Ok, None otherwise.
Sourcepub fn err_mut(&mut self) -> Option<Poke<'_, 'facet>>
pub fn err_mut(&mut self) -> Option<Poke<'_, 'facet>>
Returns the Err value as a mutable Poke if the result is Err, None otherwise.
Sourcepub fn set_ok<T: Facet<'facet>>(&mut self, value: T) -> Result<(), ReflectError>
pub fn set_ok<T: Facet<'facet>>(&mut self, value: T) -> Result<(), ReflectError>
Sets the result to Ok(value), dropping the previous value.
Sourcepub fn set_err<E: Facet<'facet>>(
&mut self,
value: E,
) -> Result<(), ReflectError>
pub fn set_err<E: Facet<'facet>>( &mut self, value: E, ) -> Result<(), ReflectError>
Sets the result to Err(value), dropping the previous value.
Sourcepub fn set_ok_from_heap<const BORROW: bool>(
&mut self,
value: HeapValue<'facet, BORROW>,
) -> Result<(), ReflectError>
pub fn set_ok_from_heap<const BORROW: bool>( &mut self, value: HeapValue<'facet, BORROW>, ) -> Result<(), ReflectError>
Sourcepub fn set_err_from_heap<const BORROW: bool>(
&mut self,
value: HeapValue<'facet, BORROW>,
) -> Result<(), ReflectError>
pub fn set_err_from_heap<const BORROW: bool>( &mut self, value: HeapValue<'facet, BORROW>, ) -> Result<(), ReflectError>
Sourcepub const fn into_inner(self) -> Poke<'mem, 'facet>
pub const fn into_inner(self) -> Poke<'mem, 'facet>
Converts this PokeResult back into a Poke
Sourcepub fn as_peek_result(&self) -> PeekResult<'_, 'facet>
pub fn as_peek_result(&self) -> PeekResult<'_, 'facet>
Returns a read-only PeekResult view