use std::borrow::Cow;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub(crate) struct Mark {
pub offset: usize,
pub line: usize,
pub column: usize,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum ScalarStyle {
Plain,
SingleQuoted,
DoubleQuoted,
Literal,
Folded,
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub(crate) struct Props<'a> {
pub anchor: Option<Cow<'a, str>>,
pub tag: Option<Cow<'a, str>>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) enum EventKind<'a> {
StreamStart,
StreamEnd,
DocumentStart {
explicit: bool,
version: Option<(u32, u32)>,
},
DocumentEnd {
explicit: bool,
},
SequenceStart {
props: Props<'a>,
flow: bool,
},
SequenceEnd,
MappingStart {
props: Props<'a>,
flow: bool,
},
MappingEnd,
Scalar {
props: Props<'a>,
style: ScalarStyle,
value: Cow<'a, str>,
},
Alias {
anchor: Cow<'a, str>,
},
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct Event<'a> {
pub kind: EventKind<'a>,
pub start: Mark,
pub end: Mark,
}