pub struct Span {
pub start: u32,
pub end: u32,
}Expand description
A byte-offset range within a TOML document.
Convertible to and from Range<u32> and
Range<usize>.
Fields§
§start: u32Start byte offset (inclusive).
end: u32End byte offset (exclusive).
Implementations§
Source§impl Span
impl Span
Sourcepub fn range(self) -> Range<usize>
pub fn range(self) -> Range<usize>
Converts this span into a Range<usize>.
Sourcepub fn grow_key_to_header(&mut self, text: &[u8])
pub fn grow_key_to_header(&mut self, text: &[u8])
Grows a key span to cover the full header brackets.
For [a.b.c] with a key span on b, produces the span of [a.b.c].
Handles [[aot]] as well.
Sourcepub fn extract_header_span(&self, text: &[u8]) -> Span
pub fn extract_header_span(&self, text: &[u8]) -> Span
Extracts the header-line span from a HEADER table span.
The HEADER span covers [ through the last body value. This returns
just the [key.path] or [[aot]] portion.
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