pub struct Document { /* private fields */ }Expand description
A document read against a Shape: the part that could be read, and a diagnostic for
everything that could not.
Reading never writes, never repairs and never panics. See the module documentation for what each kind of problem becomes.
Implementations§
Source§impl Document
impl Document
Sourcepub fn parse(file: &str, text: &str, shape: &Shape) -> Self
pub fn parse(file: &str, text: &str, shape: &Shape) -> Self
Reads TOML text as the document shape describes, reporting problems against file.
Sourcepub fn open(path: impl AsRef<Path>, shape: &Shape) -> Result<Self>
pub fn open(path: impl AsRef<Path>, shape: &Shape) -> Result<Self>
Reads the document at path, reporting problems against the file’s name.
§Errors
Returns the I/O error when the file cannot be read. A file that is not there is one of those errors, not an empty document: a data file the application has not written yet and one it wrote empty mean different things, and only the application knows which it expects.
Sourcepub fn diagnostics(&self) -> &[Diagnostic]
pub fn diagnostics(&self) -> &[Diagnostic]
Every problem found while reading, in the order they were found.
Trait Implementations§
impl Eq for Document
impl StructuralPartialEq for Document
Auto Trait Implementations§
impl Freeze for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnsafeUnpin for Document
impl UnwindSafe for Document
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more