pub struct TomlDocument<T> { /* private fields */ }Expand description
A typed store file plus the document it came from.
Implementations§
Source§impl<T: StoreModel> TomlDocument<T>
impl<T: StoreModel> TomlDocument<T>
Sourcepub fn parse(text: &str) -> Result<Self, Diagnostic>
pub fn parse(text: &str) -> Result<Self, Diagnostic>
Parses text. Fails with one diagnostic: parse_error (not TOML),
missing_field or unsupported_schema (the schema key), or
missing_field/invalid_value (the text does not fit T).
Sourcepub fn save(&self, fs: &dyn Fs, path: &Path) -> Result<(), CoreError>
pub fn save(&self, fs: &dyn Fs, path: &Path) -> Result<(), CoreError>
Writes Self::to_text to path.
pub fn value(&self) -> &T
pub fn value_mut(&mut self) -> &mut T
pub fn into_value(self) -> T
Trait Implementations§
Source§impl<T: Clone> Clone for TomlDocument<T>
impl<T: Clone> Clone for TomlDocument<T>
Auto Trait Implementations§
impl<T> Forget for TomlDocument<T>
impl<T> Freeze for TomlDocument<T>where
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Item>: Freeze,
PhantomData<usize>: Freeze,
PhantomData<Bucket<Key, Item>>: Freeze,
T: Freeze,
impl<T> Move for TomlDocument<T>
impl<T> RefUnwindSafe for TomlDocument<T>where
T: RefUnwindSafe,
impl<T> Send for TomlDocument<T>
impl<T> Sync for TomlDocument<T>
impl<T> Unpin for TomlDocument<T>
impl<T> UnsafeUnpin for TomlDocument<T>where
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Item>: UnsafeUnpin,
PhantomData<usize>: UnsafeUnpin,
PhantomData<Bucket<Key, Item>>: UnsafeUnpin,
T: UnsafeUnpin,
impl<T> UnwindSafe for TomlDocument<T>
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