Skip to main content

List

Struct List 

Source
pub struct List<T, B> { /* private fields */ }
Expand description

List object.

Implementations§

Source§

impl<T, B> List<T, B>

Source

pub fn new(objects: Vec<IndexedObject<T, B>>) -> Self

Creates a new list object.

Source

pub fn len(&self) -> usize

Returns the number of objects in the list.

Source

pub fn is_empty(&self) -> bool

Checks whether the list holds no objects.

Source

pub fn entry(&self) -> &[IndexedObject<T, B>] ⓘ

Returns the objects of the @list entry, in list order.

Alias for as_slice.

Source

pub fn entry_mut(&mut self) -> &mut Vec<IndexedObject<T, B>> ⓘ

Mutably borrows the objects of the @list entry.

Source

pub fn as_slice(&self) -> &[IndexedObject<T, B>] ⓘ

Returns the objects of the list as a slice, in list order.

Source

pub fn as_mut_slice(&mut self) -> &mut [IndexedObject<T, B>] ⓘ

Returns the objects of the list as a mutable slice, in list order.

Source

pub fn into_entry(self) -> Vec<IndexedObject<T, B>> ⓘ

Consumes the list, returning the objects of its @list entry.

Source

pub fn push(&mut self, object: IndexedObject<T, B>)

Appends an object to the end of the list.

Source

pub fn pop(&mut self) -> Option<IndexedObject<T, B>>

Removes the last object of the list and returns it.

Source

pub fn iter(&self) -> Iter<'_, IndexedObject<T, B>> ⓘ

Returns an iterator over the objects of the list, in list order.

Source

pub fn iter_mut(&mut self) -> IterMut<'_, IndexedObject<T, B>> ⓘ

Returns a mutable iterator over the objects of the list, in list order.

Source

pub fn canonicalize_with(&mut self, buffer: &mut Buffer)

Puts every literal of the list into canonical form, using the given buffer to render numbers.

Source

pub fn canonicalize(&mut self)

Puts every literal of the list into canonical form.

Source

pub fn map_ids<U, C>( self, map_iri: impl FnMut(T) -> U, map_id: impl FnMut(Id<T, B>) -> Id<U, C>, ) -> List<U, C>
where U: Eq + Hash, C: Eq + Hash,

Rewrites every IRI and identifier of the list (recursively) with the given functions.

Trait Implementations§

Source§

impl<T, B> Any<T, B> for List<T, B>

Source§

fn as_ref(&self) -> Ref<'_, T, B>

Borrows the object as a value, node or list reference.
Source§

fn id(&self) -> Option<&Id<T, B>>

Returns the identifier (@id) of the object, if it is a node object with one.
Source§

fn language<'a>(&'a self) -> Option<&'a LenientLangTag>
where T: 'a, B: 'a,

Returns the language tag of this value, if it carries one.
Source§

fn is_value(&self) -> bool

Checks whether the object is a value object.
Source§

fn is_node(&self) -> bool

Checks whether the object is a node object.
Source§

fn is_graph(&self) -> bool

Checks whether the object is a graph object (a node object with a @graph entry).
Source§

fn is_list(&self) -> bool

Checks whether the object is a list object.
Source§

impl<T: Clone, B: Clone> Clone for List<T, B>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, B: Debug> Debug for List<T, B>

Source§

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

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

impl<T, B> Drop for List<T, B>

Source§

fn drop(&mut self)

Drops the list’s objects iteratively, as Node drops its own.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<T: Eq + Hash, B: Eq + Hash> Eq for List<T, B>

Source§

impl<T: Hash, B: Hash> Hash for List<T, B>

Source§

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

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<'a, T, B> IntoIterator for &'a List<T, B>

Source§

type Item = &'a Indexed<Object<T, B>>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, Indexed<Object<T, B>>>

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<'a, T, B> IntoIterator for &'a mut List<T, B>

Source§

type Item = &'a mut Indexed<Object<T, B>>

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'a, Indexed<Object<T, B>>>

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<T, B> IntoIterator for List<T, B>

Source§

type Item = Indexed<Object<T, B>>

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<Indexed<Object<T, B>>>

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<T, B, N: Vocabulary<Iri = T, BlankId = B>> IntoJsonWithContext<N> for List<T, B>

Source§

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

Converts this value into JSON, resolving the identifiers it holds against the given vocabulary. Read more
Source§

impl<T, B, I: Interpretation> LinkedData<I> for List<T, B>

Source§

fn visit<S>(&self, visitor: S) -> Result<S::Ok, S::Error>
where S: Visitor<I>,

Visit the RDF dataset represented by this type.
Source§

impl<T, B, I: Interpretation> LinkedDataGraph<I> for List<T, B>

Source§

fn visit_graph<S>(&self, visitor: S) -> Result<S::Ok, S::Error>
where S: GraphVisitor<I>,

Visits the subjects of the graph represented by this value.
Source§

impl<T, B, I: Interpretation> LinkedDataPredicateObjects<I> for List<T, B>

Source§

fn visit_objects<S>(&self, visitor: S) -> Result<S::Ok, S::Error>

Visits the objects this predicate points at.
Source§

impl<T, B, I: Interpretation> LinkedDataResource<I> for List<T, B>

Source§

fn interpretation( &self, _interpretation: &mut I, ) -> ResourceInterpretation<'_, I>

Returns the interpretation of this resource, inserting it into interpretation if required.
Source§

fn lexical_representation<'a>( &'a self, interpretation: &'a mut I, ) -> Option<CowRdfTerm<'a>>

Returns the lexical term representing this resource, if any.
Source§

fn reference_interpretation( &self, interpretation: &mut I, ) -> ResourceInterpretation<'_, I>

Returns the interpretation to use when this resource appears as a reference rather than as a subject with properties.
Source§

impl<T, B, I: Interpretation> LinkedDataSubject<I> for List<T, B>

Source§

fn visit_subject<S>(&self, visitor: S) -> Result<S::Ok, S::Error>
where S: SubjectVisitor<I>,

Visits the properties of the subject represented by this value.
Source§

impl<T: Eq + Hash, B: Eq + Hash> MappedEq for List<T, B>

Source§

type BlankId = B

Blank node identifier type the renaming applies to.
Source§

fn mapped_eq<'a, 'b, F: Clone + Fn(&'a B) -> &'b B>( &'a self, other: &Self, f: F, ) -> bool
where B: 'a + 'b,

Structural equality with mapped blank identifiers. Read more
Source§

impl<T, B> PartialEq for List<T, B>
where T: Eq + Hash, B: Eq + Hash,

Source§

fn eq(&self, __other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<T, B> Relabel<T, B> for List<T, B>

Source§

fn relabel_with<N: VocabularyMut<Iri = T, BlankId = B>, G: LocalGenerator>( &mut self, vocabulary: &mut N, generator: &mut G, relabeling: &mut HashMap<B, ValidId<T, B>>, ) -> Result<(), GeneratedIdError>
where T: Clone + Eq + Hash, B: Clone + Eq + Hash,

Relabels every blank node, recording the mapping so shared nodes keep the same new identifier. Read more
Source§

fn relabel<G: LocalGenerator>( &mut self, generator: &mut G, relabeling: &mut HashMap<B, ValidId<T, B>>, ) -> Result<(), GeneratedIdError>
where T: Clone + Eq + Hash, B: Clone + Eq + Hash, (): Vocabulary<Iri = T, BlankId = B>,

Relabels every blank node, recording the mapping. Read more

Auto Trait Implementations§

§

impl<T, B> Freeze for List<T, B>
where Vec<Indexed<Object<T, B>>>: Freeze,

§

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

§

impl<T, B> Send for List<T, B>
where Vec<Indexed<Object<T, B>>>: Send,

§

impl<T, B> Sync for List<T, B>
where Vec<Indexed<Object<T, B>>>: Sync,

§

impl<T, B> Unpin for List<T, B>
where Vec<Indexed<Object<T, B>>>: Unpin,

§

impl<T, B> UnsafeUnpin for List<T, B>
where Vec<Indexed<Object<T, B>>>: UnsafeUnpin,

§

impl<T, B> UnwindSafe for List<T, B>
where Vec<Indexed<Object<T, 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> 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> BorrowUnordered for T

Source§

fn as_unordered(&self) -> &Unordered<T>

Views this value as an Unordered reference.
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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 self is equivalent to key.
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

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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

type Error = !

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<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>
where T: Sized,

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