SchemaSystem

Struct SchemaSystem 

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

Provides functions for instantiating instances of Schema.

SchemaSystem is Send and Sync i.e. it is safe to send it to another thread and to be shared between threads. For cases when one does need thread-safe interior mutability, they can use the explicit locking via std::sync::Mutex and std::sync::RwLock.

Implementations§

Source§

impl SchemaSystem

Source

pub fn new(authorities: Vec<Box<dyn DocumentAuthority>>) -> Self

Source

pub fn load_schema<A: AsRef<str>>( &mut self, id: A, ) -> IonSchemaResult<Arc<Schema>>

Requests each of the provided DocumentAuthoritys, in order, to resolve the requested schema id until one successfully resolves it. If an authority throws an exception, resolution silently proceeds to the next authority. This method returns an Arc<Schema> which allows to load this schema once re-use it across threads.

Source

pub fn new_schema( &mut self, schema_content: &[u8], id: &str, ) -> IonSchemaResult<Arc<Schema>>

Constructs a new schema using provided ISL content.

Source

pub fn load_isl_schema<A: AsRef<str>>( &mut self, id: A, ) -> IonSchemaResult<IslSchema>

Requests each of the provided DocumentAuthoritys, in order, to get ISL model for the requested schema id until one successfully resolves it. If an authority throws an exception, resolution silently proceeds to the next authority.

Source

pub fn new_isl_schema( &mut self, schema_content: &[u8], id: &str, ) -> IonSchemaResult<IslSchema>

Constructs a new ISL model using provided ISL content.

Source

pub fn load_schema_from_isl_schema_v1_0( &mut self, isl: IslSchema, ) -> IonSchemaResult<Arc<Schema>>

Resolves given ISL 1.0 model into a Schema. If the given ISL model has any ISL 2.0 related types/constraints, resolution returns an error. This method returns an Arc<Schema> which allows to load this schema once re-use it across threads.

Source

pub fn load_schema_from_isl_schema_v2_0( &mut self, isl: IslSchema, ) -> IonSchemaResult<Arc<Schema>>

Resolves given ISL 2.0 model into a Schema. If the given ISL model has any ISL 1.0 related types/constraints, resolution returns an error. This method returns an Arc<Schema> which allows to load this schema once re-use it across threads.

Source

pub fn schema_from_isl_types_v1_0<A: AsRef<str>, B: Into<Vec<IslType>>>( &self, id: A, isl_types: B, ) -> IonSchemaResult<Schema>

Creates a schema from given IslTypes using ISL 1.0 Note: This method assumes that there are no imported type definitions used for these IslTypes

Source

pub fn schema_from_isl_types_v2_0<A: AsRef<str>, B: Into<Vec<IslType>>>( &self, id: A, isl_types: B, ) -> IonSchemaResult<Schema>

Creates a schema from given IslTypes using ISL 2.0 Note: This method assumes that there are no imported type definitions used for these IslTypes

Auto Trait Implementations§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.