Skip to main content

Model

Struct Model 

Source
pub struct Model { /* private fields */ }
Expand description

The types of one or more logical models, by canonical URL.

Implementations§

Source§

impl Model

Source

pub fn new() -> Self

Source

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.

Source

pub fn add_folder(&mut self, folder: &Path) -> Result<usize>

Adds every StructureDefinition in a folder of JSON files (a package’s package folder).

Source

pub fn len(&self) -> usize

Source

pub fn types(&self) -> impl Iterator<Item = &Arc<TypeDef>>

Every type, in no particular order.

Source

pub fn is_empty(&self) -> bool

Source

pub fn get(&self, url: &str) -> Option<&Arc<TypeDef>>

The type at a canonical URL (a |version suffix is ignored).

Source

pub fn contains(&self, url: &str) -> bool

Whether the model has a type at url.

Source

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.

Source

pub fn root(&self, spec: &str) -> Option<Root<'_>>

The root a name gives: a canonical URL or type name, or either followed by .element.

Source

pub fn roots(&self, namespace: Option<&str>, name: &str) -> Vec<&Arc<TypeDef>>

The types whose documents have this root element.

Source

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/).

Source

pub fn derives_from(&self, ty: &TypeDef, ancestor: &str) -> bool

Whether ty is ancestor or derives from it.

Trait Implementations§

Source§

impl Clone for Model

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Model

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Model

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Forget for Model

§

impl Freeze for Model

§

impl RefUnwindSafe for Model

§

impl Send for Model

§

impl Sync for Model

§

impl Unpin for Model

§

impl UnsafeUnpin for Model

§

impl UnwindSafe for Model

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.