Enum json_ld::Object

source ·
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.

You can get an Object by expanding a JSON-LD document using the expansion algorithm or by converting an already expanded JSON document using TryFromJson.

Variants§

§

Value(Value<T, M>)

Value object.

§

Node(Box<Node<T, B, M>, Global>)

Node object.

§

List(List<T, B, M>)

List object.

Implementations§

Creates a new node object from a node.

Identifier of the object, if it is a node object.

Assigns an identifier to every node included in this object using the given generator.

Use the given generator to assign an identifier to all nodes that don’t have one.

Puts this object literals into canonical form using the given buffer.

The buffer is used to compute the canonical form of numbers.

Puts this object literals into canonical form.

Returns an iterator over the types of the object.

Identifier of the object as an IRI.

If the object is a node identified by an IRI, returns this IRI. Returns None otherwise.

Tests if the object is a value.

Returns this object as a value, if it is one.

Converts this object as a value, if it is one.

Tests if the object is a node.

Returns this object as a node, if it is one.

Converts this object into a node, if it is one.

Tests if the object is a graph object (a node with a @graph field).

Tests if the object is a list.

Returns this object as a list, if it is one.

Converts this object into a list, if it is one.

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.

Get the value as a boolean, if it is.

Get the value as a number, if it is.

If the object is a language-tagged value, Return its associated language.

Returns an iterator over all fragments of this object, including the object itself.

Fragments include:

  • objects
  • key-value pairs,
  • keys
  • values

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.

Returns an iterator over the entries of JSON representation of the object.

Trait Implementations§

source§

fn id_entry<'a>(&'a self) -> Option<&'a Entry<Id<T, B>, M>>where
    M: 'a,

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
Structural equality with mapped blank identifiers. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Wraps self inside a Meta<Self, M> using the given metadata. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Checks if this value is equivalent to the given key. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.