pub enum Object<T = IriBuf, B = BlankIdBuf, M = ()> {
Value(Value<T, M>),
Node(Box<Node<T, B, M>, Global>),
List(List<T, B, M>),
}
Expand description
Object.
JSON-LD connects together multiple kinds of data objects. Objects may be nodes, values or lists of objects.
Variants
Value(Value<T, M>)
Value object.
Node(Box<Node<T, B, M>, Global>)
Node object.
List(List<T, B, M>)
List object.
Implementations
sourceimpl<T, B, M> Object<T, B, M>
impl<T, B, M> Object<T, B, M>
sourcepub fn id(&self) -> Option<&Meta<Id<T, B>, M>>
pub fn id(&self) -> Option<&Meta<Id<T, B>, M>>
Identifier of the object, if it is a node object.
sourcepub fn identify_all_with<N, G>(&mut self, vocabulary: &mut N, generator: &mut G)where
G: Generator<T, B, M, N>,
M: Clone,
pub fn identify_all_with<N, G>(&mut self, vocabulary: &mut N, generator: &mut G)where
G: Generator<T, B, M, N>,
M: Clone,
Assigns an identifier to every node included in this object using the given generator
.
pub fn identify_all<G>(&mut self, generator: &mut G)where
G: Generator<T, B, M, ()>,
M: Clone,
pub fn types(&self) -> Types<'_, T, B, M>ⓘNotable traits for Types<'a, T, B, M>impl<'a, T, B, M> Iterator for Types<'a, T, B, M> type Item = TypeRef<'a, T, B>;
sourcepub fn as_iri(&self) -> Option<&T>
pub fn as_iri(&self) -> Option<&T>
Identifier of the object as an IRI.
If the object is a node identified by an IRI, returns this IRI.
Returns None
otherwise.
sourcepub fn into_value(self) -> Option<Value<T, M>>
pub fn into_value(self) -> Option<Value<T, M>>
Converts this object as a value, if it is one.
sourcepub fn into_node(self) -> Option<Node<T, B, M>>
pub fn into_node(self) -> Option<Node<T, B, M>>
Converts this object into a node, if it is one.
sourcepub fn is_graph(&self) -> bool
pub fn is_graph(&self) -> bool
Tests if the object is a graph object (a node with a @graph
field).
sourcepub fn into_list(self) -> Option<List<T, B, M>>
pub fn into_list(self) -> Option<List<T, B, M>>
Converts this object into a list, if it is one.
sourcepub fn as_str(&self) -> Option<&str>where
T: AsRef<str>,
B: AsRef<str>,
pub fn as_str(&self) -> Option<&str>where
T: AsRef<str>,
B: AsRef<str>,
Get the object as a string.
If the object is a value that is a string, returns this string.
If the object is a node that is identified, returns the identifier as a string.
Returns None
otherwise.
sourcepub fn language(&self) -> Option<LenientLanguageTag<'_>>
pub fn language(&self) -> Option<LenientLanguageTag<'_>>
If the object is a language-tagged value, Return its associated language.
pub fn traverse(&self) -> Traverse<'_, T, B, M>ⓘNotable traits for Traverse<'a, T, B, M>impl<'a, T, B, M> Iterator for Traverse<'a, T, B, M> type Item = FragmentRef<'a, T, B, M>;
sourcepub fn equivalent(&self, other: &Object<T, B, M>) -> boolwhere
T: Eq + Hash,
B: Eq + Hash,
pub fn equivalent(&self, other: &Object<T, B, M>) -> boolwhere
T: Eq + Hash,
B: Eq + Hash,
Equivalence operator.
Equivalence is different from equality for anonymous objects: List objects and anonymous node objects have an implicit unlabeled blank nodes and thus never equivalent.
pub fn entries(&self) -> Entries<'_, T, B, M>ⓘNotable traits for Entries<'a, T, B, M>impl<'a, T, B, M> Iterator for Entries<'a, T, B, M> type Item = EntryRef<'a, T, B, M>;
Trait Implementations
sourceimpl<T, B, M> Any<T, B, M> for Object<T, B, M>
impl<T, B, M> Any<T, B, M> for Object<T, B, M>
fn as_ref(&self) -> Ref<'_, T, B, M>
fn id_entry<'a>(&'a self) -> Option<&'a Entry<Id<T, B>, M>>where
M: 'a,
fn id<'a>(&'a self) -> Option<&'a Meta<Id<T, B>, M>>where
M: 'a,
fn language<'a>(&'a self) -> Option<LenientLanguageTag<'a>>where
T: 'a,
B: 'a,
M: 'a,
fn is_value(&self) -> bool
fn is_node(&self) -> bool
fn is_graph(&self) -> bool
fn is_list(&self) -> bool
sourceimpl<T, B, M, N> IntoJsonWithContextMeta<M, N> for Object<T, B, M>where
M: Clone,
N: Vocabulary<Iri = T, BlankId = B>,
impl<T, B, M, N> IntoJsonWithContextMeta<M, N> for Object<T, B, M>where
M: Clone,
N: Vocabulary<Iri = T, BlankId = B>,
fn into_json_meta_with(self, meta: M, vocabulary: &N) -> Meta<Value<M>, M>
sourceimpl<T, B, M> PartialEq<Object<T, B, M>> for Object<T, B, M>where
T: Eq + Hash,
B: Eq + Hash,
M: PartialEq<M>,
impl<T, B, M> PartialEq<Object<T, B, M>> for Object<T, B, M>where
T: Eq + Hash,
B: Eq + Hash,
M: PartialEq<M>,
sourceimpl<T, B, M> StrippedHash for Object<T, B, M>where
T: Hash,
B: Hash,
impl<T, B, M> StrippedHash for Object<T, B, M>where
T: Hash,
B: Hash,
fn stripped_hash<H>(&self, state: &mut H)where
H: Hasher,
sourceimpl<T, B, M> StrippedPartialEq<Object<T, B, M>> for Object<T, B, M>where
T: Eq + Hash,
B: Eq + Hash,
impl<T, B, M> StrippedPartialEq<Object<T, B, M>> for Object<T, B, M>where
T: Eq + Hash,
B: Eq + Hash,
fn stripped_eq(&self, other: &Object<T, B, M>) -> bool
sourceimpl<T, B, M> TryFromJson<T, B, M> for Object<T, B, M>where
T: Eq + Hash,
B: Eq + Hash,
impl<T, B, M> TryFromJson<T, B, M> for Object<T, B, M>where
T: Eq + Hash,
B: Eq + Hash,
fn try_from_json_in(
vocabulary: &mut impl VocabularyMut<Iri = T, BlankId = B>,
Meta<Value<M>, M>
) -> Result<Meta<Object<T, B, M>, M>, Meta<InvalidExpandedJson<M>, M>>
sourceimpl<T, B, M> TryFromJsonObject<T, B, M> for Object<T, B, M>where
T: Eq + Hash,
B: Eq + Hash,
impl<T, B, M> TryFromJsonObject<T, B, M> for Object<T, B, M>where
T: Eq + Hash,
B: Eq + Hash,
fn try_from_json_object_in(
vocabulary: &mut impl VocabularyMut<Iri = T, BlankId = B>,
Meta<Object<M>, M>
) -> Result<Meta<Object<T, B, M>, M>, Meta<InvalidExpandedJson<M>, M>>
impl<T, B, M> Eq for Object<T, B, M>where
T: Eq + Hash,
B: Eq + Hash,
M: Eq,
impl<T, B, M> StrippedEq for Object<T, B, M>where
T: Eq + Hash,
B: Eq + Hash,
Auto Trait Implementations
impl<T, B, M> RefUnwindSafe for Object<T, B, M>where
B: RefUnwindSafe,
M: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, B, M> Send for Object<T, B, M>where
B: Send,
M: Send,
T: Send,
impl<T, B, M> Sync for Object<T, B, M>where
B: Sync,
M: Sync,
T: Sync,
impl<T, B, M> Unpin for Object<T, B, M>where
M: Unpin,
T: Unpin,
impl<T, B, M> UnwindSafe for Object<T, B, M>where
B: UnwindSafe,
M: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> BorrowStripped for T
impl<T> BorrowStripped for T
sourceimpl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
sourceimpl<I, B, M, T> CompactIndexedFragment<I, B, M> for Twhere
T: Any<I, B, M>,
impl<I, B, M, T> CompactIndexedFragment<I, B, M> for Twhere
T: Any<I, B, M>,
fn compact_indexed_fragment<N, C, L>(
&'a self,
vocabulary: &'a mut N,
meta: &'a M,
index: Option<&'a Entry<String, M>>,
active_context: &'a Context<I, B, C, M>,
type_scoped_context: &'a Context<I, B, C, M>,
active_property: Option<Meta<&'a str, &'a M>>,
loader: &'a mut L,
options: Options
) -> Pin<Box<dyn Future<Output = Result<Meta<Value<M>, M>, Meta<Error<<L as ContextLoader<I, M>>::ContextError>, M>>> + Send + 'a, Global>>where
L: Loader<I, M> + ContextLoader<I, M> + Send + Sync,
N: Send + Sync + VocabularyMut<Iri = I, BlankId = B>,
I: Clone + Hash + Eq + Send + Sync,
B: Clone + Hash + Eq + Send + Sync,
M: Clone + Send + Sync,
C: ProcessMeta<I, B, M>,
<L as ContextLoader<I, M>>::Context: Into<C>,
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
fn equivalent(&self, key: &K) -> bool
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.