Enum Context

Source
pub enum Context {
    One(ContextEntry),
    Many(Vec<ContextEntry>),
}
Expand description

JSON-LD Context.

Can represent a single context entry, or a list of context entries.

Variants§

Implementations§

Source§

impl Context

Source

pub fn one(context: ContextEntry) -> Context

Creates a new context with a single entry.

Source

pub fn null() -> Context

Creates the null context.

Source

pub fn iri_ref(iri_ref: IriRefBuf) -> Context

Creates a new context with a single IRI-reference entry.

Source

pub fn definition(def: Definition) -> Context

Creates a new context with a single context definition entry.

Source§

impl Context

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn as_slice(&self) -> &[ContextEntry]

Source

pub fn is_object(&self) -> bool

Source

pub fn is_array(&self) -> bool

Source

pub fn traverse(&self) -> Traverse<'_>

Source

pub fn iter(&self) -> Iter<'_, ContextEntry>

Trait Implementations§

Source§

impl Clone for Context

Source§

fn clone(&self) -> Context

Returns a duplicate 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 Debug for Context

Source§

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

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

impl Default for Context

Source§

fn default() -> Context

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

impl<'de> Deserialize<'de> for Context

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Context, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'a> From<&'a Iri> for Context

Source§

fn from(i: &'a Iri) -> Context

Converts to this type from the input type.
Source§

impl<'a> From<&'a IriRef> for Context

Source§

fn from(i: &'a IriRef) -> Context

Converts to this type from the input type.
Source§

impl From<ContextEntry> for Context

Source§

fn from(c: ContextEntry) -> Context

Converts to this type from the input type.
Source§

impl From<Definition> for Context

Source§

fn from(c: Definition) -> Context

Converts to this type from the input type.
Source§

impl From<IriBuf> for Context

Source§

fn from(i: IriBuf) -> Context

Converts to this type from the input type.
Source§

impl From<IriRefBuf> for Context

Source§

fn from(i: IriRefBuf) -> Context

Converts to this type from the input type.
Source§

impl<'a> IntoIterator for &'a Context

Source§

type IntoIter = Iter<'a, ContextEntry>

Which kind of iterator are we turning this into?
Source§

type Item = &'a ContextEntry

The type of the elements being iterated over.
Source§

fn into_iter(self) -> <&'a Context as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl IntoIterator for Context

Source§

type Item = ContextEntry

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <Context as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl IntoJson for Context

Source§

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

Source§

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

Source§

impl PartialEq for Context

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PrecomputeSize for Context

Source§

fn pre_compute_size(&self, options: &Options, sizes: &mut Vec<Size>) -> Size

Source§

impl Print for Context

Source§

fn fmt_with( &self, f: &mut Formatter<'_>, options: &Options, indent: usize, ) -> Result<(), Error>

Source§

fn pretty_print(&self) -> Printed<'_, Self>

Print the value with Options::pretty options.
Source§

fn compact_print(&self) -> Printed<'_, Self>

Print the value with Options::compact options.
Source§

fn inline_print(&self) -> Printed<'_, Self>

Print the value with Options::inline options.
Source§

fn print_with(&self, options: Options) -> Printed<'_, Self>

Print the value with the given options.
Source§

impl PrintWithSize for Context

Source§

fn fmt_with_size( &self, f: &mut Formatter<'_>, options: &Options, indent: usize, sizes: &[Size], index: &mut usize, ) -> Result<(), Error>

Source§

impl Process for Context

Source§

async fn process_full<N, L, W>( &self, vocabulary: &mut N, active_context: &Context<<N as IriVocabulary>::Iri, <N as BlankIdVocabulary>::BlankId>, loader: &L, base_url: Option<<N as IriVocabulary>::Iri>, options: Options, warnings: W, ) -> Result<Processed<'_, <N as IriVocabulary>::Iri, <N as BlankIdVocabulary>::BlankId>, Error>

Process the local context with specific options.
Source§

async fn process_with<N, L>( &self, vocabulary: &mut N, active_context: &Context<<N as IriVocabulary>::Iri, <N as BlankIdVocabulary>::BlankId>, loader: &L, base_url: Option<<N as IriVocabulary>::Iri>, options: Options, ) -> Result<Processed<'_, <N as IriVocabulary>::Iri, <N as BlankIdVocabulary>::BlankId>, Error>

Process the local context with specific options.
Source§

async fn process<N, L>( &self, vocabulary: &mut N, loader: &L, base_url: Option<<N as IriVocabulary>::Iri>, ) -> Result<Processed<'_, <N as IriVocabulary>::Iri, <N as BlankIdVocabulary>::BlankId>, Error>

Process the local context with the given initial active context with the default options: is_remote is false, override_protected is false and propagate is true.
Source§

impl Serialize for Context

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFromJson for Context

Source§

impl Eq for Context

Source§

impl StructuralPartialEq for Context

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> 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> 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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, 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

Source§

type Output = T

Should always be Self
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> ToOwned for T

Source§

type Owned = T

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

Source§

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>,

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

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

Source§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,