Event

Enum Event 

Source
pub enum Event<'src> {
Show 16 variants DocumentStart, DocumentEnd, ObjectStart { span: Span, separator: Separator, }, ObjectEnd { span: Span, }, SequenceStart { span: Span, }, SequenceEnd { span: Span, }, EntryStart, Key { span: Span, tag: Option<&'src str>, payload: Option<Cow<'src, str>>, kind: ScalarKind, }, EntryEnd, Scalar { span: Span, value: Cow<'src, str>, kind: ScalarKind, }, Unit { span: Span, }, TagStart { span: Span, name: &'src str, }, TagEnd, Comment { span: Span, text: &'src str, }, DocComment { span: Span, text: &'src str, }, Error { span: Span, kind: ParseErrorKind, },
}
Expand description

Events emitted by the parser.

Variants§

§

DocumentStart

Start of document.

§

DocumentEnd

End of document.

§

ObjectStart

Start of an object { ... }.

Fields

§span: Span

Span of the opening brace.

§separator: Separator

Detected separator mode.

§

ObjectEnd

End of an object.

Fields

§span: Span

Span of the closing brace.

§

SequenceStart

Start of a sequence ( ... ).

Fields

§span: Span

Span of the opening paren.

§

SequenceEnd

End of a sequence.

Fields

§span: Span

Span of the closing paren.

§

EntryStart

Start of an entry (key-value pair).

§

Key

A key in an entry.

Keys can be scalars or unit, optionally tagged. Objects, sequences, and heredocs are not allowed as keys.

Fields

§span: Span

Span of the key.

§tag: Option<&'src str>

Tag name if this key is tagged (without @).

§payload: Option<Cow<'src, str>>

Scalar payload after escape processing. None means unit.

§kind: ScalarKind

Kind of scalar used for the key. Only meaningful if payload is Some.

§

EntryEnd

End of an entry.

§

Scalar

A scalar value.

Fields

§span: Span

Span of the scalar.

§value: Cow<'src, str>

Value after escape processing.

§kind: ScalarKind

Kind of scalar.

§

Unit

Unit value @.

Fields

§span: Span

Span of the unit.

§

TagStart

Start of a tag @name.

Fields

§span: Span

Span of the tag (including @).

§name: &'src str

Tag name (without @).

§

TagEnd

End of a tag.

§

Comment

Line comment // ....

Fields

§span: Span

Span of the comment.

§text: &'src str

Comment text (including //).

§

DocComment

Doc comment /// ....

Fields

§span: Span

Span of the doc comment.

§text: &'src str

Doc comment text (including ///).

§

Error

Parse error.

Fields

§span: Span

Span where error occurred.

§kind: ParseErrorKind

Kind of error.

Trait Implementations§

Source§

impl<'src> Clone for Event<'src>

Source§

fn clone(&self) -> Event<'src>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'src> Debug for Event<'src>

Source§

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

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

impl<'src> PartialEq for Event<'src>

Source§

fn eq(&self, other: &Event<'src>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'src> Eq for Event<'src>

Source§

impl<'src> StructuralPartialEq for Event<'src>

Auto Trait Implementations§

§

impl<'src> Freeze for Event<'src>

§

impl<'src> RefUnwindSafe for Event<'src>

§

impl<'src> Send for Event<'src>

§

impl<'src> Sync for Event<'src>

§

impl<'src> Unpin for Event<'src>

§

impl<'src> UnwindSafe for Event<'src>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.