Skip to main content

FieldDecoder

Struct FieldDecoder 

Source
pub struct FieldDecoder<'de> { /* private fields */ }
Available on crate feature schema-evolution only.
Expand description

Stable-ID field access used by SchemaDecode implementations.

Implementations§

Source§

impl<'de> FieldDecoder<'de>

Source

pub fn required<T: NsonDeserialize<'de>>(&mut self, id: u32) -> Result<T>

Decodes a required field and reports a missing-field error.

Source

pub fn optional<T: NsonDeserialize<'de>>( &mut self, id: u32, ) -> Result<Option<T>>

Decodes an optional field, returning None when it is absent.

Source

pub fn or_default<T: NsonDeserialize<'de> + Default>( &mut self, id: u32, ) -> Result<T>

Decodes a field or returns its type’s default when absent.

Source

pub fn unknown_fields(&self) -> impl Iterator<Item = UnknownField<'de>> + '_

Returns fields that have not been consumed by this schema revision.

Auto Trait Implementations§

§

impl<'de> Forget for FieldDecoder<'de>

§

impl<'de> Freeze for FieldDecoder<'de>

§

impl<'de> RefUnwindSafe for FieldDecoder<'de>

§

impl<'de> Send for FieldDecoder<'de>

§

impl<'de> Sync for FieldDecoder<'de>

§

impl<'de> Unpin for FieldDecoder<'de>

§

impl<'de> UnsafeUnpin for FieldDecoder<'de>

§

impl<'de> UnwindSafe for FieldDecoder<'de>

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.