pub struct ImDocument<S> { /* private fields */ }
Expand description
Type representing a parsed TOML document
Implementations§
Source§impl<S: AsRef<str>> ImDocument<S>
impl<S: AsRef<str>> ImDocument<S>
Source§impl<S> ImDocument<S>
impl<S> ImDocument<S>
Source§impl<S: AsRef<str>> ImDocument<S>
impl<S: AsRef<str>> ImDocument<S>
Source§impl<S: AsRef<str>> ImDocument<S>
impl<S: AsRef<str>> ImDocument<S>
Sourcepub fn into_mut(self) -> DocumentMut
pub fn into_mut(self) -> DocumentMut
Allow editing of the DocumentMut
Methods from Deref<Target = Table>§
Sourcepub fn get_values(&self) -> Vec<(Vec<&Key>, &Value)>
pub fn get_values(&self) -> Vec<(Vec<&Key>, &Value)>
Get key/values for values that are visually children of this table
For example, this will return dotted keys
Sourcepub fn is_implicit(&self) -> bool
pub fn is_implicit(&self) -> bool
If a table has no key/value pairs and implicit, it will not be displayed.
Sourcepub fn is_dotted(&self) -> bool
pub fn is_dotted(&self) -> bool
Check if this is a wrapper for dotted keys, rather than a standard table
Sourcepub fn position(&self) -> Option<usize>
pub fn position(&self) -> Option<usize>
The position of the Table
within the DocumentMut
.
Returns None
if the Table
was created manually (i.e. not via parsing)
in which case its position is set automatically. This can be overridden with
Table::set_position
.
Sourcepub fn key_decor(&self, key: &str) -> Option<&Decor>
👎Deprecated since 0.21.1: Replaced with key_mut
pub fn key_decor(&self, key: &str) -> Option<&Decor>
key_mut
Returns the decor associated with a given key of the table.
Sourcepub fn span(&self) -> Option<Range<usize>>
pub fn span(&self) -> Option<Range<usize>>
The location within the original document
This generally requires an ImDocument
.
Sourcepub fn get<'a>(&'a self, key: &str) -> Option<&'a Item>
pub fn get<'a>(&'a self, key: &str) -> Option<&'a Item>
Returns an optional reference to an item given the key.
Sourcepub fn get_key_value<'a>(&'a self, key: &str) -> Option<(&'a Key, &'a Item)>
pub fn get_key_value<'a>(&'a self, key: &str) -> Option<(&'a Key, &'a Item)>
Return references to the key-value pair stored for key, if it is present, else None.
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Returns true if the table contains an item with the given key.
Sourcepub fn contains_table(&self, key: &str) -> bool
pub fn contains_table(&self, key: &str) -> bool
Returns true if the table contains a table with the given key.
Sourcepub fn contains_value(&self, key: &str) -> bool
pub fn contains_value(&self, key: &str) -> bool
Returns true if the table contains a value with the given key.
Sourcepub fn contains_array_of_tables(&self, key: &str) -> bool
pub fn contains_array_of_tables(&self, key: &str) -> bool
Returns true if the table contains an array of tables with the given key.
Trait Implementations§
Source§impl<S: Clone> Clone for ImDocument<S>
impl<S: Clone> Clone for ImDocument<S>
Source§fn clone(&self) -> ImDocument<S>
fn clone(&self) -> ImDocument<S>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<S: Debug> Debug for ImDocument<S>
impl<S: Debug> Debug for ImDocument<S>
Source§impl Default for ImDocument<&'static str>
impl Default for ImDocument<&'static str>
Source§impl<S> Deref for ImDocument<S>
impl<S> Deref for ImDocument<S>
Auto Trait Implementations§
impl<S> Freeze for ImDocument<S>where
S: Freeze,
impl<S> RefUnwindSafe for ImDocument<S>where
S: RefUnwindSafe,
impl<S> Send for ImDocument<S>where
S: Send,
impl<S> Sync for ImDocument<S>where
S: Sync,
impl<S> Unpin for ImDocument<S>where
S: Unpin,
impl<S> UnwindSafe for ImDocument<S>where
S: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.