pub enum Expanded<T, B> {
Null,
Object(IndexedObject<T, B>),
Array(Vec<IndexedObject<T, B>>),
}Expand description
Result of expanding a fragment of a JSON-LD document.
Expansion may leave nothing behind, produce a single object, or turn one
element into several — which is why it is not simply an
IndexedObject.
Variants§
Null
The fragment expanded to nothing, and is dropped.
Object(IndexedObject<T, B>)
The fragment expanded to a single object.
Array(Vec<IndexedObject<T, B>>)
The fragment expanded to any number of objects.
Implementations§
Source§impl<T, B> Expanded<T, B>
impl<T, B> Expanded<T, B>
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Checks whether the fragment expanded to no object at all, either because it expanded to nothing or to an empty array.
Sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Checks whether the fragment expanded to nothing, as opposed to an empty array of objects.
Sourcepub fn is_list(&self) -> bool
pub fn is_list(&self) -> bool
Checks whether the fragment expanded to a single list object (a @list
entry).
Sourcepub fn map_ids<U, C>(
self,
map_iri: impl FnMut(T) -> U,
map_id: impl FnMut(Id<T, B>) -> Id<U, C>,
) -> Expanded<U, C>
pub fn map_ids<U, C>( self, map_iri: impl FnMut(T) -> U, map_id: impl FnMut(Id<T, B>) -> Id<U, C>, ) -> Expanded<U, C>
Rewrites every IRI and identifier of this expansion result (recursively) with the given functions.
map_iri translates the datatype IRI of the literal values, map_id
the node identifiers, node types and property identifiers. Use it to
move a result produced against one vocabulary into the identifier space
of another.
Trait Implementations§
Source§impl<T, B> From<Indexed<Object<T, B>>> for Expanded<T, B>
impl<T, B> From<Indexed<Object<T, B>>> for Expanded<T, B>
Source§fn from(obj: IndexedObject<T, B>) -> Expanded<T, B>
fn from(obj: IndexedObject<T, B>) -> Expanded<T, B>
Source§impl<T, B> IntoIterator for Expanded<T, B>
impl<T, B> IntoIterator for Expanded<T, B>
Source§impl<'a, T, B> IntoIterator for &'a Expanded<T, B>
impl<'a, T, B> IntoIterator for &'a Expanded<T, B>
Auto Trait Implementations§
impl<T, B> Freeze for Expanded<T, B>
impl<T, B> RefUnwindSafe for Expanded<T, B>
impl<T, B> Send for Expanded<T, B>
impl<T, B> Sync for Expanded<T, B>
impl<T, B> Unpin for Expanded<T, B>
impl<T, B> UnsafeUnpin for Expanded<T, B>
impl<T, B> UnwindSafe for Expanded<T, B>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
Source§fn as_unordered(&self) -> &Unordered<T>
fn as_unordered(&self) -> &Unordered<T>
Unordered reference.