Enum json_ld_syntax::context::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) -> Self

Creates a new context with a single entry.

source

pub fn null() -> Self

Creates the null context.

source

pub fn iri_ref(iri_ref: IriRefBuf) -> Self

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

source

pub fn definition(def: Definition) -> Self

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 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 Debug for Context

source§

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

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

impl Default for Context

source§

fn default() -> Self

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

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

impl From<ContextEntry> for Context

source§

fn from(c: ContextEntry) -> Self

Converts to this type from the input type.
source§

impl From<Definition> for Context

source§

fn from(c: Definition) -> Self

Converts to this type from the input type.
source§

impl From<IriBuf> for Context

source§

fn from(i: IriBuf) -> Self

Converts to this type from the input type.
source§

impl From<IriRefBuf> for Context

source§

fn from(i: IriRefBuf) -> Self

Converts to this type from the input type.
source§

impl<'a> IntoIterator for &'a Context

§

type IntoIter = Iter<'a, ContextEntry>

Which kind of iterator are we turning this into?
§

type Item = &'a ContextEntry

The type of the elements being iterated over.
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl IntoIterator for Context

§

type Item = ContextEntry

The type of the elements being iterated over.
§

type IntoIter = IntoIter

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl IntoJson for Context

source§

impl PartialEq for Context

source§

fn eq(&self, other: &Context) -> 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.
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

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

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