MarkedYaml

Struct MarkedYaml 

Source
pub struct MarkedYaml<'input> {
    pub span: Span,
    pub data: YamlData<'input, MarkedYaml<'input>>,
}
Expand description

A YAML node with Spans pointing to the start of the node.

This structure does not implement functions to operate on the YAML object. To access those, refer to the Self::data field.

§Warning

In order to allow indexing by content in mappings, equality comparisons for this structure ignore the Span.

Fields§

§span: Span

The span indicating where in the input stream the object is.

The markers are relative to the start of the input stream that was given to the parser, not to the start of the document within the input stream.

§data: YamlData<'input, MarkedYaml<'input>>

The YAML contents of the node.

Implementations§

Source§

impl<'input> MarkedYaml<'input>

Source

pub fn value_from_str(v: &'input str) -> Self

Convert a string to a scalar node.

See YamlData::value_from_str for more details.

The returned node is created with a default Span.

Source

pub fn scalar_from_string(v: String) -> Self

Same as Self::value_from_str but uses a String instead.

See YamlData::value_from_str for more details.

The returned node is created with a default Span.

Source

pub fn value_from_cow(v: Cow<'input, str>) -> Self

Same as Self::value_from_str but uses a Cow instead.

See YamlData::value_from_str for more details.

The returned node is created with a default Span.

Source

pub fn value_from_cow_and_metadata( v: Cow<'input, str>, style: ScalarStyle, tag: Option<&Cow<'input, Tag>>, ) -> Self

Convert a string to a scalar node, abiding by the given metadata.

The variant returned by this function will always be a YamlData::Value, unless the tag forces a particular type and the representation cannot be parsed as this type, in which case it returns a YamlData::BadValue.

The returned node is created with a default Span.

Trait Implementations§

Source§

impl AnnotatedNode for MarkedYaml<'_>

Source§

impl<'input> Clone for MarkedYaml<'input>

Source§

fn clone(&self) -> MarkedYaml<'input>

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<'input> Debug for MarkedYaml<'input>

Source§

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

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

impl<'a> From<YamlData<'a, MarkedYaml<'a>>> for MarkedYaml<'a>

Source§

fn from(value: YamlData<'a, MarkedYaml<'a>>) -> Self

Converts to this type from the input type.
Source§

impl Hash for MarkedYaml<'_>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'input> LoadableYamlNode<'input> for MarkedYaml<'input>

Source§

type HashKey = MarkedYaml<'input>

The type of the key for the hash variant of the YAML node. Read more
Source§

fn from_bare_yaml(yaml: Yaml<'input>) -> Self

Create an instance of Self from a Yaml. Read more
Source§

fn is_sequence(&self) -> bool

Return whether the YAML node is an array. Read more
Source§

fn is_mapping(&self) -> bool

Return whether the YAML node is a hash. Read more
Source§

fn is_badvalue(&self) -> bool

Return whether the YAML node is BadValue.
Source§

fn into_tagged(self, tag: Cow<'input, Tag>) -> Self

Turn self into a Tagged node, using the given tag. Read more
Source§

fn sequence_mut(&mut self) -> &mut Vec<Self>

Retrieve the sequence variant of the YAML node. Read more
Source§

fn mapping_mut(&mut self) -> &mut LinkedHashMap<Self::HashKey, Self>

Retrieve the mapping variant of the YAML node. Read more
Source§

fn take(&mut self) -> Self

Take the contained node out of Self, leaving a BadValue in its place.
Source§

fn with_span(self, span: Span) -> Self

Provide the span for the node (builder-style). Read more
Source§

fn with_start_marker(self, mark: Marker) -> Self

Provide the start-marker for the node (builder-style). Read more
Source§

fn with_end_marker(self, mark: Marker) -> Self

Provide the end-marker for the node (builder-style). Read more
Source§

fn load_from_str(source: &str) -> Result<Vec<Self>, ScanError>

Load the given string as an array of YAML documents. Read more
Source§

fn load_from_iter<I: Iterator<Item = char>>( source: I, ) -> Result<Vec<Self>, ScanError>

Load the contents of the given iterator as an array of YAML documents. Read more
Source§

fn load_from_parser<I: Input>( parser: &mut Parser<'input, I>, ) -> Result<Vec<Self>, ScanError>

Load the contents from the specified Parser as an array of YAML documents. Read more
Source§

impl<'b> PartialEq<MarkedYaml<'b>> for MarkedYaml<'_>

Source§

fn eq(&self, other: &MarkedYaml<'b>) -> 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 Eq for MarkedYaml<'_>

Auto Trait Implementations§

§

impl<'input> Freeze for MarkedYaml<'input>

§

impl<'input> RefUnwindSafe for MarkedYaml<'input>

§

impl<'input> Send for MarkedYaml<'input>

§

impl<'input> Sync for MarkedYaml<'input>

§

impl<'input> Unpin for MarkedYaml<'input>

§

impl<'input> UnwindSafe for MarkedYaml<'input>

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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.