pub struct Model { /* private fields */ }Expand description
The types of one or more logical models, by canonical URL.
Implementations§
Source§impl Model
impl Model
pub fn new() -> Self
Sourcepub fn add(&mut self, resource: &Value) -> bool
pub fn add(&mut self, resource: &Value) -> bool
Adds a StructureDefinition. Profiles (constraints on another type) are not types of their own and are skipped, as are definitions without a snapshot. Returns whether it was added.
Sourcepub fn add_folder(&mut self, folder: &Path) -> Result<usize>
pub fn add_folder(&mut self, folder: &Path) -> Result<usize>
Adds every StructureDefinition in a folder of JSON files (a package’s package folder).
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn get(&self, url: &str) -> Option<&Arc<TypeDef>>
pub fn get(&self, url: &str) -> Option<&Arc<TypeDef>>
The type at a canonical URL (a |version suffix is ignored).
Sourcepub fn by_type_name(
&self,
namespace: Option<&str>,
name: &str,
) -> Option<&Arc<TypeDef>>
pub fn by_type_name( &self, namespace: Option<&str>, name: &str, ) -> Option<&Arc<TypeDef>>
The type an xsi:type names: by namespace and name, or by name when only one type has it.
Sourcepub fn root(&self, spec: &str) -> Option<Root<'_>>
pub fn root(&self, spec: &str) -> Option<Root<'_>>
The root a name gives: a canonical URL or type name, or either followed by .element.
Sourcepub fn roots(&self, namespace: Option<&str>, name: &str) -> Vec<&Arc<TypeDef>>
pub fn roots(&self, namespace: Option<&str>, name: &str) -> Vec<&Arc<TypeDef>>
The types whose documents have this root element.
Sourcepub fn type_of(&self, code: &str, context: &str) -> Option<&Arc<TypeDef>>
pub fn type_of(&self, code: &str, context: &str) -> Option<&Arc<TypeDef>>
The type a type code of an element names, resolved like the element’s own URL: a URL as
it is, anything else in the namespace of context (http://…/StructureDefinition/).
Sourcepub fn derives_from(&self, ty: &TypeDef, ancestor: &str) -> bool
pub fn derives_from(&self, ty: &TypeDef, ancestor: &str) -> bool
Whether ty is ancestor or derives from it.