Struct json_ld::Indexed

source ·
pub struct Indexed<T> { /* private fields */ }
Expand description

Indexed objects.

Nodes and value objects may be indexed by a string in JSON-LD. This type is a wrapper around any kind of indexable data.

It is a pointer type that Deref into the underlying value.

Implementations§

source§

impl<T> Indexed<T>

source

pub fn none(value: T) -> Indexed<T>

Creates a non-indexed value, without metadata.

source

pub fn new(value: T, index: Option<String>) -> Indexed<T>

Create a new (maybe) indexed value.

source

pub fn inner(&self) -> &T

Get a reference to the inner value.

source

pub fn inner_mut(&mut self) -> &mut T

source

pub fn into_inner(self) -> T

Drop the index and return the underlying value.

source

pub fn index(&self) -> Option<&str>

Get the index, if any.

source

pub fn set_index(&mut self, index: Option<String>)

Set the value index.

source

pub fn into_parts(self) -> (T, Option<String>)

Turn this indexed value into its components: inner value and index.

source

pub fn map_inner<U, F>(self, f: F) -> Indexed<U>
where F: FnOnce(T) -> U,

Cast the inner value.

source

pub fn cast<U>(self) -> Indexed<U>
where U: From<T>,

Cast the inner value.

source

pub fn try_cast<U>( self ) -> Result<Indexed<U>, Indexed<<U as TryFrom<T>>::Error>>
where U: TryFrom<T>,

Try to cast the inner value.

source§

impl<T, B> Indexed<Node<T, B>>

source

pub fn entries(&self) -> IndexedEntries<'_, T, B>

source§

impl<T, B> Indexed<Node<T, B>>
where T: Eq + Hash, B: Eq + Hash,

source

pub fn equivalent(&self, other: &Indexed<Node<T, B>>) -> bool

source§

impl<T, B> Indexed<Object<T, B>>
where T: Eq + Hash, B: Eq + Hash,

source

pub fn equivalent(&self, other: &Indexed<Object<T, B>>) -> bool

source§

impl<T, B> Indexed<Object<T, B>>

source

pub fn into_indexed_node(self) -> Option<Indexed<Node<T, B>>>

Converts this indexed object into an indexed node, if it is one.

source

pub fn into_indexed_value(self) -> Option<Indexed<Value<T>>>

Converts this indexed object into an indexed node, if it is one.

source

pub fn into_indexed_list(self) -> Option<Indexed<List<T, B>>>

Converts this indexed object into an indexed list, if it is one.

source

pub fn into_unnamed_graph( self ) -> Result<IndexSet<Indexed<Object<T, B>>>, Indexed<Object<T, B>>>

Try to convert this object into an unnamed graph.

source

pub fn entries(&self) -> IndexedEntries<'_, T, B>

Trait Implementations§

source§

impl<T> AsMut<T> for Indexed<T>

source§

fn as_mut(&mut self) -> &mut T

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<T> AsRef<T> for Indexed<T>

source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
source§

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

source§

fn clone(&self) -> Indexed<T>

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<I, B, T> CompactFragment<I, B> for Indexed<T>
where T: CompactIndexedFragment<I, B>,

source§

async fn compact_fragment_full<'a, N, L>( &'a self, vocabulary: &'a mut N, active_context: &'a Context<I, B>, type_scoped_context: &'a Context<I, B>, active_property: Option<&'a str>, loader: &'a mut L, options: Options ) -> Result<Value, Error<<L as Loader<I>>::Error>>
where N: VocabularyMut<Iri = I, BlankId = B>, I: Clone + Hash + Eq, B: Clone + Hash + Eq, L: Loader<I>,

source§

impl<T> Debug for Indexed<T>
where T: Debug,

source§

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

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

impl<T> Deref for Indexed<T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &T

Dereferences the value.
source§

impl<T> DerefMut for Indexed<T>

source§

fn deref_mut(&mut self) -> &mut T

Mutably dereferences the value.
source§

impl<T, B> Extend<Indexed<Object<T, B>>> for ExpandedDocument<T, B>
where T: Hash + Eq, B: Hash + Eq,

source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = Indexed<Object<T, B>>>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<T, B> From<Indexed<Node<T, B>>> for ExpandedDocument<T, B>
where T: Eq + Hash, B: Eq + Hash,

source§

fn from(value: Indexed<Node<T, B>>) -> ExpandedDocument<T, B>

Converts to this type from the input type.
source§

impl<T> From<T> for Indexed<T>

source§

fn from(value: T) -> Indexed<T>

Converts to this type from the input type.
source§

impl<T, B> FromIterator<Indexed<Object<T, B>>> for ExpandedDocument<T, B>
where T: Hash + Eq, B: Hash + Eq,

source§

fn from_iter<I>(iter: I) -> ExpandedDocument<T, B>
where I: IntoIterator<Item = Indexed<Object<T, B>>>,

Creates a value from an iterator. Read more
source§

impl<T> Hash for Indexed<T>
where T: Hash,

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T, N> IntoJsonWithContext<N> for Indexed<T>
where T: IntoJsonWithContext<N>,

source§

fn into_json_with(self, vocabulary: &N) -> Value

source§

impl<T> MappedEq for Indexed<T>
where T: MappedEq,

§

type BlankId = <T as MappedEq>::BlankId

source§

fn mapped_eq<'a, 'b, F>(&'a self, other: &Indexed<T>, f: F) -> bool
where F: Clone + Fn(&'a <Indexed<T> as MappedEq>::BlankId) -> &'b <Indexed<T> as MappedEq>::BlankId, <Indexed<T> as MappedEq>::BlankId: 'a + 'b,

Structural equality with mapped blank identifiers. Read more
source§

impl<T> Ord for Indexed<T>
where T: Ord,

source§

fn cmp(&self, other: &Indexed<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<T> PartialEq for Indexed<T>
where T: PartialEq,

source§

fn eq(&self, other: &Indexed<T>) -> 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<T> PartialOrd for Indexed<T>
where T: PartialOrd,

source§

fn partial_cmp(&self, other: &Indexed<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T, B, N> PrecomputeSizeWithContext<N> for Indexed<Node<T, B>>
where N: Vocabulary<Iri = T, BlankId = B>,

source§

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

source§

impl<T, B, N> PrecomputeSizeWithContext<N> for Indexed<Object<T, B>>
where N: Vocabulary<Iri = T, BlankId = B>,

source§

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

source§

impl<T, B, N> PrintWithSizeAndContext<N> for Indexed<Node<T, B>>
where N: Vocabulary<Iri = T, BlankId = B>,

source§

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

source§

impl<T, B, N> PrintWithSizeAndContext<N> for Indexed<Object<T, B>>
where N: Vocabulary<Iri = T, BlankId = B>,

source§

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

source§

impl<T, B, O> TryFromJson<T, B> for Indexed<O>
where O: TryFromJsonObject<T, B>,

source§

fn try_from_json_in( vocabulary: &mut impl VocabularyMut<Iri = T, BlankId = B>, value: Value ) -> Result<Indexed<O>, InvalidExpandedJson>

source§

impl<T, B, O> TryFromJsonObject<T, B> for Indexed<O>
where O: TryFromJsonObject<T, B>,

source§

fn try_from_json_object_in( vocabulary: &mut impl VocabularyMut<Iri = T, BlankId = B>, object: Object ) -> Result<Indexed<O>, InvalidExpandedJson>

source§

impl<T> Eq for Indexed<T>
where T: Eq,

source§

impl<T> StructuralPartialEq for Indexed<T>

Auto Trait Implementations§

§

impl<T> Freeze for Indexed<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Indexed<T>
where T: RefUnwindSafe,

§

impl<T> Send for Indexed<T>
where T: Send,

§

impl<T> Sync for Indexed<T>
where T: Sync,

§

impl<T> Unpin for Indexed<T>
where T: Unpin,

§

impl<T> UnwindSafe for Indexed<T>
where T: 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> CallHasher for T
where T: Hash + ?Sized,

source§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
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<!> for T

source§

fn from(t: !) -> T

Converts to this type from the input type.
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
source§

impl<V, T> RdfLiteralType<V> for T

source§

impl<T> RdfLiteralValue for T
where T: From<String> + From<Value> + From<Value>,