pub struct Span {
pub start: Marker,
pub end: Marker,
pub indent: Option<usize>,
}Expand description
A range of locations in a Yaml document.
Fields§
§start: MarkerThe start (inclusive) of the range.
end: MarkerThe end (exclusive) of the range.
indent: Option<usize>Optional indentation hint associated with this span.
This is only meaningful for certain parser-emitted events (notably: block mapping keys).
When indentation is not meaningful or cannot be provided, it must be None.
Implementations§
Source§impl Span
impl Span
Sourcepub fn empty(mark: Marker) -> Span
pub fn empty(mark: Marker) -> Span
Create a empty Span at a given location.
An empty span doesn’t contain any characters, but its position may still be meaningful.
For example, for an indented sequence SequenceEnd has a location but an empty span.
Sourcepub fn with_indent(self, indent: Option<usize>) -> Span
pub fn with_indent(self, indent: Option<usize>) -> Span
Return a copy of this Span with the given indentation hint.
Sourcepub fn byte_range(&self) -> Option<Range<usize>>
pub fn byte_range(&self) -> Option<Range<usize>>
Return the byte range of the span, if available.
Trait Implementations§
impl Copy for Span
impl Eq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnsafeUnpin for Span
impl UnwindSafe for Span
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more