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
impl SchemaSystem
pub fn new(authorities: Vec<Box<dyn DocumentAuthority>>) -> Self
Sourcepub fn load_schema<A: AsRef<str>>(
&mut self,
id: A,
) -> IonSchemaResult<Arc<Schema>>
pub fn load_schema<A: AsRef<str>>( &mut self, id: A, ) -> IonSchemaResult<Arc<Schema>>
Requests each of the provided DocumentAuthority
s, 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.
Sourcepub fn new_schema(
&mut self,
schema_content: &[u8],
id: &str,
) -> IonSchemaResult<Arc<Schema>>
pub fn new_schema( &mut self, schema_content: &[u8], id: &str, ) -> IonSchemaResult<Arc<Schema>>
Constructs a new schema using provided ISL content.
Sourcepub fn load_isl_schema<A: AsRef<str>>(
&mut self,
id: A,
) -> IonSchemaResult<IslSchema>
pub fn load_isl_schema<A: AsRef<str>>( &mut self, id: A, ) -> IonSchemaResult<IslSchema>
Requests each of the provided DocumentAuthority
s, 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.
Sourcepub fn new_isl_schema(
&mut self,
schema_content: &[u8],
id: &str,
) -> IonSchemaResult<IslSchema>
pub fn new_isl_schema( &mut self, schema_content: &[u8], id: &str, ) -> IonSchemaResult<IslSchema>
Constructs a new ISL model using provided ISL content.
Sourcepub fn load_schema_from_isl_schema_v1_0(
&mut self,
isl: IslSchema,
) -> IonSchemaResult<Arc<Schema>>
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.
Sourcepub fn load_schema_from_isl_schema_v2_0(
&mut self,
isl: IslSchema,
) -> IonSchemaResult<Arc<Schema>>
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.