pub struct SourceMap { /* private fields */ }Expand description
Positions of keys and values, by document path.
Implementations§
Source§impl SourceMap
impl SourceMap
Sourcepub fn from_text(text: &str) -> Self
pub fn from_text(text: &str) -> Self
Positions for a JSON or YAML document. Empty when the text cannot be
parsed or the yaml feature is disabled.
Sourcepub fn value(&self, path: &DocPath) -> Option<SourceSpan>
pub fn value(&self, path: &DocPath) -> Option<SourceSpan>
Position of the value at path.
Sourcepub fn key(&self, path: &DocPath) -> Option<SourceSpan>
pub fn key(&self, path: &DocPath) -> Option<SourceSpan>
Position of the key that introduces path (for object members).
Sourcepub fn locate(&self, path: &DocPath, prefer_key: bool) -> Option<SourceSpan>
pub fn locate(&self, path: &DocPath, prefer_key: bool) -> Option<SourceSpan>
Best position for a diagnostic about path: the key (when prefer_key)
or the value at the path, else the closest enclosing value that has one.
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Forget for SourceMap
impl Freeze for SourceMap
impl Move for SourceMap
impl RefUnwindSafe for SourceMap
impl Send for SourceMap
impl Sync for SourceMap
impl Unpin for SourceMap
impl UnsafeUnpin for SourceMap
impl UnwindSafe for SourceMap
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