pub struct ExtensionFile { /* private fields */ }Available on crate feature
parse only.Expand description
A parsed and validated RawExtensions: a simple extensions file.
An ExtensionFile has a canonical Urn and a parsed set of
SimpleExtensions data. It represents the extensions file as a whole.
Implementations§
Source§impl ExtensionFile
impl ExtensionFile
Sourcepub fn empty(urn: Urn) -> Self
pub fn empty(urn: Urn) -> Self
Create a new, empty ExtensionFile with an empty set of SimpleExtensions.
Sourcepub fn create(extensions: RawExtensions) -> Result<Self, SimpleExtensionsError>
pub fn create(extensions: RawExtensions) -> Result<Self, SimpleExtensionsError>
Create an ExtensionFile from raw simple extension data.
Sourcepub fn get_type(&self, name: &str) -> Option<&CustomType>
pub fn get_type(&self, name: &str) -> Option<&CustomType>
Get a type by name
Sourcepub fn types(&self) -> impl Iterator<Item = &CustomType>
pub fn types(&self) -> impl Iterator<Item = &CustomType>
Get an iterator over all types in this extension
Sourcepub fn extension(&self) -> &SimpleExtensions
pub fn extension(&self) -> &SimpleExtensions
Get a reference to the underlying SimpleExtensions.
Sourcepub fn into_raw(self) -> RawExtensions
pub fn into_raw(self) -> RawExtensions
Convert the parsed extension file back into the raw text representation by value.
Sourcepub fn to_raw(&self) -> RawExtensions
pub fn to_raw(&self) -> RawExtensions
Convert the parsed extension file back into the raw text representation by reference.
Sourcepub fn read<R: Read>(reader: R) -> Result<Self, SimpleExtensionsError>
pub fn read<R: Read>(reader: R) -> Result<Self, SimpleExtensionsError>
Read an extension file from a reader.
reader: anyReadinstance with the YAML content
Returns a parsed and validated ExtensionFile or an error.
Sourcepub fn read_from_str<S: AsRef<str>>(s: S) -> Result<Self, SimpleExtensionsError>
pub fn read_from_str<S: AsRef<str>>(s: S) -> Result<Self, SimpleExtensionsError>
Read an extension file from a string slice.