pub struct Properties<J: JsonHash, T: Id>(_);
Expand description

Properties of a node object, and their associated objects.

Example

use json_ld::{context, Document, NoLoader};
use serde_json::Value;
let doc: Value = serde_json::from_str(
  r#"
  {
     "@context": {
       "name": "http://xmlns.com/foaf/0.1/name"
     },
     "@id": "https://www.rust-lang.org",
     "name": "Rust Programming Language"
   }
"#,
)
.unwrap();

let mut loader = NoLoader::<Value>::new();

let rt  = tokio::runtime::Runtime::new().unwrap();
let expanded_doc = rt.block_on(doc
  .expand::<context::Json<Value>, _>(&mut loader)).unwrap();

let node = expanded_doc.into_iter().next().unwrap().into_indexed_node().unwrap();

for (property, objects) in node.properties() {
  assert_eq!(property, "http://xmlns.com/foaf/0.1/name");
  for object in objects {
    // do something
  }
}

Implementations

Returns the number of properties.

Checks if there are no defined properties.

Checks if the given property is associated to any object.

Returns an iterator over all the objects associated to the given property.

Get one of the objects associated to the given property.

If multiple objects are found, there are no guaranties on which object will be returned.

Associate the given object to the node through the given property.

Associate all the given objects to the node through the given property.

Returns an iterator over the properties and their associated objects.

Returns an iterator over the properties with a mutable reference to their associated objects.

Trait Implementations

Feeds this value into the given Hasher. Read more

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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

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.