pub struct Ion { /* private fields */ }Expand description
Implementations§
Source§impl Ion
impl Ion
Sourcepub fn from_str_filtered(
s: &str,
accepted_sections: Vec<&str>,
) -> Result<Self, IonError>
pub fn from_str_filtered( s: &str, accepted_sections: Vec<&str>, ) -> Result<Self, IonError>
§Errors
Returns a parser error when the input cannot be parsed into a valid Ion document.
Sourcepub fn get_mut(&mut self, key: &str) -> Option<&mut Section>
pub fn get_mut(&mut self, key: &str) -> Option<&mut Section>
Returns a mutable reference to the section associated with the given key.
If a section exists for the provided key, a mutable reference to that section is returned.
If no section is associated with the key, None is returned.
Sourcepub fn get_key_value(&self, key: &str) -> Option<(&str, &Section)>
pub fn get_key_value(&self, key: &str) -> Option<(&str, &Section)>
Retrieves a key-value pair from the sections.
This method attempts to find a section by its key within the collection of sections.
If the section exists, it returns an Option containing a tuple of the key as a
reference to a string slice and the value as a reference to a Section. If the key
does not exist within the sections, it returns None.
§Returns
Returns Option<(&str, &Section)>. If the key is found, the return value is
Some((&str, &Section)), where the first element is a reference to the key
and the second element is a reference to the corresponding Section. If the key
is not found, it returns None.
Sourcepub fn fetch(&self, key: &str) -> Result<&Section, IonError>
pub fn fetch(&self, key: &str) -> Result<&Section, IonError>
§Errors
Returns IonError::MissingSection when the key does not exist.