pub struct ParsedDocument {
    pub content: Array,
    /* private fields */
}
Expand description

Represents the parsed state of a given JSON5 document.

Fields§

§content: Array

The parsed document model represented as an array of zero or more objects to format.

Implementations§

source§

impl ParsedDocument

source

pub fn from_str(buffer: &str, filename: Option<String>) -> Result<Self, Error>

Parses the JSON5 document represented by buffer, and returns a parsed representation of the document that can be formatted by Json5Format::to_utf8().

If a filename is also provided, any parsing errors will include the filename with the line number and column where the error was encountered.

source

pub fn from_str_with_nesting_limit( buffer: &str, filename: Option<String>, nesting_limit: usize ) -> Result<Self, Error>

Like from_str() but also overrides the default nesting limit, used to catch deeply nested JSON5 documents before overflowing the program stack.

source

pub fn from_string( buffer: String, filename: Option<String> ) -> Result<Self, Error>

Parses the JSON5 document represented by buffer, and returns a parsed representation of the document that can be formatted by Json5Format::to_utf8().

The returned ParsedDocument object retains ownership of the input buffer, which can be useful in situations where borrowing the buffer (via from_str() requires burdensome workarounds.

If a filename is also provided, any parsing errors will include the filename with the line number and column where the error was encountered.

source

pub fn filename(&self) -> &Option<String>

Returns the filename, if provided when the object was created.

source

pub fn input_buffer(&self) -> &Option<String>

Borrows the input buffer owned by this object, if provided by calling from_string().

Auto Trait Implementations§

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>,

§

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>,

§

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.