Skip to main content

RecoveryContext

Struct RecoveryContext 

Source
pub struct RecoveryContext<'a> { /* private fields */ }
Expand description

Projection scope that records unknown required tags and missing required fields.

Projectors still validate each known descendant. The scope owns only the compatibility result and borrows the same admission meter as its parent.

Implementations§

Source§

impl RecoveryContext<'_>

Source

pub fn check<R>( context: &ReadContext<'_>, project: impl FnOnce(&RecoveryContext<'_>) -> Result<R, Error>, ) -> Result<R, Error>

Check a projection with no enclosing option for a marked incompatibility.

§Errors

Returns a projection error first. Returns Error::Incompatible if the projection completes with a marked incompatibility outside a recovering branch.

Source

pub const fn read_context(&self) -> &ReadContext<'_>

Borrow the current context for ordinary projection and nested branches.

Source

pub fn nested<R>( &self, project: impl FnOnce(&RecoveryContext<'_>) -> Result<R, Error>, ) -> Result<R, Error>

Admit one additional structural level within this scope.

§Errors

Returns the depth or work refusal or a projection error.

Source

pub fn project_field<'de, T: Deserialize<'de>, R>( &self, field: Field<'_, 'de>, project: impl FnOnce(T, &RecoveryContext<'_>) -> Result<R, Error>, ) -> Result<R, Error>

Project a known field at its own admitted depth within this scope.

§Errors

Returns a typed field error or a projection error. A field from a different admission context is malformed.

Source

pub fn missing_required(&self)

Mark a missing required extension in the reader’s schema.

Call this only after a complete extension visit has validated every entry header and known value. Continue projecting the remaining known siblings and propagate their errors.

Source

pub fn required_open<'de, R>( &self, open: OpaqueOpen<'de>, visit: impl FnOnce(u32, Field<'_, 'de>) -> Result<Option<R>, Error>, ) -> Result<Option<R>, Error>

Map a required open variant and mark a well-formed unknown tag.

Return None from the callback only for unknown tags. Known tags must check their typed payloads. The result is absent until the enclosing projection decides whether it can return the full value.

§Errors

Returns malformed for a zero tag, and propagates allowance and callback errors.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for RecoveryContext<'a>

§

impl<'a> !Send for RecoveryContext<'a>

§

impl<'a> !Sync for RecoveryContext<'a>

§

impl<'a> !UnwindSafe for RecoveryContext<'a>

§

impl<'a> Forget for RecoveryContext<'a>

§

impl<'a> Freeze for RecoveryContext<'a>
where &'a ReadContext<'a>: Freeze, &'a Cell<bool>: Freeze,

§

impl<'a> Move for RecoveryContext<'a>

§

impl<'a> Unpin for RecoveryContext<'a>
where &'a ReadContext<'a>: Unpin, &'a Cell<bool>: Unpin,

§

impl<'a> UnsafeUnpin for RecoveryContext<'a>

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.