Struct json_ld::Context

source ·
pub struct Context<T, B> { /* private fields */ }
Expand description

Processed JSON-LD context.

Represents the result of the context processing algorithm implemented by the json-ld-context-processing crate.

Implementations§

source§

impl<T, B> Context<T, B>

source

pub fn new(base_iri: Option<T>) -> Context<T, B>
where T: Clone,

Create a new context with the given base IRI.

source

pub fn get<Q>(&self, term: &Q) -> Option<TermDefinitionRef<'_, T, B>>
where Key: Borrow<Q>, KeywordType: Borrow<Q>, Q: Hash + Eq + ?Sized,

Returns a reference to the given term definition, if any.

source

pub fn get_normal<Q>(&self, term: &Q) -> Option<&NormalTermDefinition<T, B>>
where Key: Borrow<Q>, Q: Hash + Eq + ?Sized,

Returns a reference to the given term normal definition, if any.

source

pub fn get_type(&self) -> Option<&TypeTermDefinition>

Returns a reference to the @type definition, if any.

source

pub fn contains_term<Q>(&self, term: &Q) -> bool
where Key: Borrow<Q>, KeywordType: Borrow<Q>, Q: Hash + Eq + ?Sized,

Checks if the given term is defined.

source

pub fn original_base_url(&self) -> Option<&T>

Returns the original base URL of the context.

source

pub fn base_iri(&self) -> Option<&T>

Returns the base IRI of the context.

source

pub fn vocabulary(&self) -> Option<&Term<T, B>>

Returns the @vocab value, if any.

source

pub fn default_language(&self) -> Option<&LenientLangTag>

Returns the default @language value.

source

pub fn default_base_direction(&self) -> Option<Direction>

Returns the default @direction value.

source

pub fn previous_context(&self) -> Option<&Context<T, B>>

Returns a reference to the previous context.

source

pub fn len(&self) -> usize

Returns the number of terms defined.

source

pub fn is_empty(&self) -> bool

Checks if no terms are defined.

source

pub fn definitions(&self) -> &Definitions<T, B>

Returns a handle to the term definitions.

source

pub fn has_protected_items(&self) -> bool

Checks if the context has a protected definition.

source

pub fn inverse(&self) -> &InverseContext<T, B>
where T: Clone + Hash + Eq, B: Clone + Hash + Eq,

Returns the inverse of this context.

source

pub fn set_normal( &mut self, key: Key, definition: Option<NormalTermDefinition<T, B>> ) -> Option<NormalTermDefinition<T, B>>

Sets the normal definition for the given term key.

source

pub fn set_type( &mut self, type_: Option<TypeTermDefinition> ) -> Option<TypeTermDefinition>

Sets the @type definition.

source

pub fn set_base_iri(&mut self, iri: Option<T>)

Sets the base IRI.

source

pub fn set_vocabulary(&mut self, vocab: Option<Term<T, B>>)

Sets the @vocab value.

source

pub fn set_default_language(&mut self, lang: Option<LenientLangTagBuf>)

Sets the default @language value.

source

pub fn set_default_base_direction(&mut self, dir: Option<Direction>)

Sets the default @direction value.

source

pub fn set_previous_context(&mut self, previous: Context<T, B>)

Sets the previous context.

source

pub fn into_syntax_definition( self, vocabulary: &impl Vocabulary<Iri = T, BlankId = B> ) -> Definition

Converts this context into its syntactic definition.

Trait Implementations§

source§

impl<T, B> Clone for Context<T, B>
where T: Clone, B: Clone,

source§

fn clone(&self) -> Context<T, B>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<T, B> Default for Context<T, B>

source§

fn default() -> Context<T, B>

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

impl<'a, T, B> From<&'a Context<T, B>> for InverseContext<T, B>
where T: Clone + Hash + Eq, B: Clone + Hash + Eq,

source§

fn from(context: &'a Context<T, B>) -> InverseContext<T, B>

Converts to this type from the input type.
source§

impl<T, B> IntoSyntax<T, B> for Context<T, B>
where B: Clone,

source§

fn into_syntax( self, vocabulary: &impl Vocabulary<Iri = T, BlankId = B> ) -> Context

source§

impl<T, B> PartialEq for Context<T, B>
where T: PartialEq, B: PartialEq,

source§

fn eq(&self, other: &Context<T, B>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<T, B> !Freeze for Context<T, B>

§

impl<T, B> RefUnwindSafe for Context<T, B>

§

impl<T, B> Send for Context<T, B>
where T: Send, B: Send,

§

impl<T, B> Sync for Context<T, B>
where T: Sync + Send, B: Sync + Send,

§

impl<T, B> Unpin for Context<T, B>
where T: Unpin, B: Unpin,

§

impl<T, B> UnwindSafe for Context<T, B>
where T: UnwindSafe, B: UnwindSafe,

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> At for T

source§

fn at<M>(self, metadata: M) -> Meta<T, M>

Wraps self inside a Meta<Self, M> using the given metadata. 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> BorrowStripped for T

source§

fn stripped(&self) -> &Stripped<T>

source§

impl<T> BorrowUnordered for T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, C> FromWithContext<T, C> for T

source§

fn from_with(value: T, _context: &C) -> T

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, C> IntoWithContext<U, C> for T
where U: FromWithContext<T, C>,

source§

fn into_with(self, context: &C) -> U

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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> ToOwned for T

§

type Owned = T

source§

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

§

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, C> TryFromWithContext<U, C> for T
where U: IntoWithContext<T, C>,

§

type Error = Infallible

source§

fn try_from_with( value: U, context: &C ) -> Result<T, <T as TryFromWithContext<U, C>>::Error>

source§

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

§

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.
source§

impl<T, U, C> TryIntoWithContext<U, C> for T
where U: TryFromWithContext<T, C>,

§

type Error = <U as TryFromWithContext<T, C>>::Error

source§

fn try_into_with( self, context: &C ) -> Result<U, <T as TryIntoWithContext<U, C>>::Error>

source§

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

source§

fn with<C>(&self, context: C) -> Contextual<&T, C>

source§

fn into_with<C>(self, context: C) -> Contextual<T, C>

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more