Skip to main content

Root

Struct Root 

Source
pub struct Root<'de> {
    pub ctx: Context<'de>,
    /* private fields */
}
Expand description

Holds both the root table and the parsing context for deserialization.

During deserialization the document tree remains immutable. Use Root::into_table() to extract the table for mutable access.

Fields§

§ctx: Context<'de>

Implementations§

Source§

impl<'de> Root<'de>

Source

pub fn into_table(self) -> Table<'de>

Extracts the root table for mutable access. Root is consumed. You can also access the root table immutably via Root::table().

Source

pub fn into_item(self) -> Item<'de>

Converts the root table into an Item with the same span and payload.

Source

pub fn table(&self) -> &Table<'de>

Access the root table immutably.

Source§

impl<'de> Root<'de>

Source

pub fn helper<'ctx>(&'ctx mut self) -> TableHelper<'ctx, 'ctx, 'de>

Create a TableHelper for the root table.

Source

pub fn deserialize<T>(&mut self) -> Result<T, Failed>
where T: Deserialize<'de>,

Deserialize the root table into a typed value.

Source

pub fn errors(&self) -> &[Error]

Returns the accumulated deserialization errors.

Source

pub fn has_errors(&self) -> bool

Returns true if any deserialization errors have been recorded.

Trait Implementations§

Source§

impl Debug for Root<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Index<&str> for Root<'de>

Source§

type Output = MaybeItem<'de>

The returned type after indexing.
Source§

fn index(&self, key: &str) -> &Self::Output

Performs the indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<'de> Freeze for Root<'de>

§

impl<'de> !RefUnwindSafe for Root<'de>

§

impl<'de> !Send for Root<'de>

§

impl<'de> !Sync for Root<'de>

§

impl<'de> Unpin for Root<'de>

§

impl<'de> UnsafeUnpin for Root<'de>

§

impl<'de> !UnwindSafe for Root<'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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.