pub struct RecoverSlot<'a, T>(/* private fields */);Expand description
An optional, length-bounded payload that can recover an unknown required case.
Implementations§
Source§impl<'a, T> RecoverSlot<'a, T>
impl<'a, T> RecoverSlot<'a, T>
Sourcepub fn write(
context: &WriteContext<'_>,
value: &T,
scratch: &'a mut [u8],
) -> Result<Self, Error>where
T: Serialize,
pub fn write(
context: &WriteContext<'_>,
value: &T,
scratch: &'a mut [u8],
) -> Result<Self, Error>where
T: Serialize,
Prepare a present branch in the supplied scratch.
§Errors
Returns the first resource, encoding or scratch refusal.
Sourcepub fn project<R>(
self,
context: &ReadContext<'_>,
project: impl FnOnce(T, &RecoveryContext<'_>) -> Result<R, Error>,
) -> Result<Option<R>, Error>where
T: Deserialize<'a>,
pub fn project<R>(
self,
context: &ReadContext<'_>,
project: impl FnOnce(T, &RecoveryContext<'_>) -> Result<R, Error>,
) -> Result<Option<R>, Error>where
T: Deserialize<'a>,
Project the branch through its nearest recovery scope.
§Errors
Returns a resource or payload failure. A marked unknown required tag yields absence after the projection checks the remaining known parts.
Trait Implementations§
Source§impl<T> Clone for RecoverSlot<'_, T>
impl<T> Clone for RecoverSlot<'_, T>
impl<T> Copy for RecoverSlot<'_, T>
Source§impl<'de: 'a, 'a, T> Deserialize<'de> for RecoverSlot<'a, T>
impl<'de: 'a, 'a, T> Deserialize<'de> for RecoverSlot<'a, T>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<'a, T> Forget for RecoverSlot<'a, T>
impl<'a, T> Freeze for RecoverSlot<'a, T>
impl<'a, T> Move for RecoverSlot<'a, T>
impl<'a, T> RefUnwindSafe for RecoverSlot<'a, T>
impl<'a, T> Send for RecoverSlot<'a, T>
impl<'a, T> Sync for RecoverSlot<'a, T>
impl<'a, T> Unpin for RecoverSlot<'a, T>
impl<'a, T> UnsafeUnpin for RecoverSlot<'a, T>
impl<'a, T> UnwindSafe for RecoverSlot<'a, T>where
&'a [u8]: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more