Struct json_ns::Context [−][src]
pub struct Context { pub ns: Option<String>, pub lang: String, pub prefixes: BTreeMap<String, String>, pub aliases: BTreeMap<String, String>, pub container: BTreeMap<String, String>, }
Structure holding the current context to interpret a document with.
An instance of this struct is part of the Processor
, which can be modified to provide an
external context to interpret documents with. Such a custom context can also be created from
JSON using one of the From
implementations.
Fields
ns: Option<String>
The default namespace, for properties that are not a keyword, CURIE, or IRI.
lang: String
The Default language for internationalised properties that don't specify one. The empty string when not defined.
prefixes: BTreeMap<String, String>
Map of defined CURIE prefixes to their base IRIs.
aliases: BTreeMap<String, String>
Map of defined aliases by their literal property names.
container: BTreeMap<String, String>
Map of defined container mappings by their literal property names.
Methods
impl Context
[src]
impl Context
pub fn new() -> Context
[src]
pub fn new() -> Context
An alias for Context::default()
.
pub fn merge_value(&mut self, value: &Value)
[src]
pub fn merge_value(&mut self, value: &Value)
Merge an @context
value into this structure.
pub fn merge_object(&mut self, object: &Map<String, Value>)
[src]
pub fn merge_object(&mut self, object: &Map<String, Value>)
Merge an @context
object into this structure.
pub fn expand_name<'a>(&self, name: &'a str) -> Option<Cow<'a, str>>
[src]
pub fn expand_name<'a>(&self, name: &'a str) -> Option<Cow<'a, str>>
Expand a name according to this context.
A name may be an absolute IRI, a CURIE within a defined namespace, or a name in the default
namespace, otherwise None
is returned (and the property or value should be dropped).
Trait Implementations
impl Clone for Context
[src]
impl Clone for Context
fn clone(&self) -> Context
[src]
fn clone(&self) -> Context
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Context
[src]
impl Debug for Context
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for Context
[src]
impl Default for Context
impl<'a> From<&'a Value> for Context
[src]
impl<'a> From<&'a Value> for Context
impl<'a> From<&'a Map<String, Value>> for Context
[src]
impl<'a> From<&'a Map<String, Value>> for Context