pub struct Context<'de> {
pub arena: &'de Arena,
pub errors: Vec<Error>,
/* private fields */
}Expand description
Shared deserialization state that accumulates errors and holds the arena.
A Context is created by parse and lives inside
Root. Pass it into TableHelper::new or
Item::table_helper when implementing Deserialize.
Multiple errors can be recorded during a single deserialization pass;
inspect them afterwards via Root::errors.
Fields§
§arena: &'de Arena§errors: Vec<Error>Implementations§
Source§impl<'de> Context<'de>
impl<'de> Context<'de>
Sourcepub fn error_expected_but_found(
&mut self,
message: &'static str,
found: &Item<'_>,
) -> Failed
pub fn error_expected_but_found( &mut self, message: &'static str, found: &Item<'_>, ) -> Failed
Records a “expected X, found Y” type-mismatch error and returns Failed.
Sourcepub fn error_message_at(&mut self, message: &'static str, at: Span) -> Failed
pub fn error_message_at(&mut self, message: &'static str, at: Span) -> Failed
Records a custom error message at the given span and returns Failed.
Sourcepub fn push_error(&mut self, error: Error) -> Failed
pub fn push_error(&mut self, error: Error) -> Failed
Auto Trait Implementations§
impl<'de> Freeze for Context<'de>
impl<'de> !RefUnwindSafe for Context<'de>
impl<'de> !Send for Context<'de>
impl<'de> !Sync for Context<'de>
impl<'de> Unpin for Context<'de>
impl<'de> UnsafeUnpin for Context<'de>
impl<'de> !UnwindSafe for Context<'de>
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