pub struct YamlFile {
pub display: PathBuf,
pub text: String,
pub value: Value,
}Expand description
A parsed YAML file, kept with its source text so keys can be located for diagnostics.
Fields§
§display: PathBufPath as shown in diagnostics (relative to the project root when inside it).
text: String§value: ValueImplementations§
Source§impl YamlFile
impl YamlFile
Sourcepub fn load(
path: &Path,
display: PathBuf,
diags: &mut Diagnostics,
) -> Option<YamlFile>
pub fn load( path: &Path, display: PathBuf, diags: &mut Diagnostics, ) -> Option<YamlFile>
Parse path, recording a diagnostic (with line) and returning None on failure.
pub fn parse( text: String, display: PathBuf, diags: &mut Diagnostics, ) -> Option<YamlFile>
Sourcepub fn line_of(&self, key: &str, after: Option<usize>) -> Option<usize>
pub fn line_of(&self, key: &str, after: Option<usize>) -> Option<usize>
Best-effort line of key: in this file. With after, searches from that line on,
which is enough to find nested keys under a located parent.
Sourcepub fn line_containing(&self, needle: &str) -> Option<usize>
pub fn line_containing(&self, needle: &str) -> Option<usize>
Best-effort line of the first occurrence of needle anywhere in the file.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for YamlFile
impl RefUnwindSafe for YamlFile
impl Send for YamlFile
impl Sync for YamlFile
impl Unpin for YamlFile
impl UnsafeUnpin for YamlFile
impl UnwindSafe for YamlFile
Blanket Implementations§
impl<T> Allocation for T
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