pub struct Node {
pub id: NodeId,
pub labels: Vec<Arc<str>>,
pub properties: BTreeMap<PropertyKey, Value>,
}Expand description
A node with its labels and properties fully loaded.
This is what you get back from LpgStore::get_node().
For bulk operations, the store works with NodeRecord internally.
§Example
use grafeo_core::graph::lpg::Node;
use grafeo_common::types::NodeId;
let mut person = Node::new(NodeId::new(1));
person.add_label("Person");
person.set_property("name", "Alice");
person.set_property("age", 30i64);
assert!(person.has_label("Person"));Fields§
§id: NodeIdUnique identifier.
labels: Vec<Arc<str>>Labels attached to this node.
properties: BTreeMap<PropertyKey, Value>Properties stored on this node.
Implementations§
Source§impl Node
impl Node
Sourcepub fn with_labels(
id: NodeId,
labels: impl IntoIterator<Item = impl Into<Arc<str>>>,
) -> Self
pub fn with_labels( id: NodeId, labels: impl IntoIterator<Item = impl Into<Arc<str>>>, ) -> Self
Creates a new node with labels.
Sourcepub fn remove_label(&mut self, label: &str) -> bool
pub fn remove_label(&mut self, label: &str) -> bool
Removes a label from this node.
Sourcepub fn set_property(
&mut self,
key: impl Into<PropertyKey>,
value: impl Into<Value>,
)
pub fn set_property( &mut self, key: impl Into<PropertyKey>, value: impl Into<Value>, )
Sets a property on this node.
Sourcepub fn get_property(&self, key: &str) -> Option<&Value>
pub fn get_property(&self, key: &str) -> Option<&Value>
Gets a property from this node.
Sourcepub fn remove_property(&mut self, key: &str) -> Option<Value>
pub fn remove_property(&mut self, key: &str) -> Option<Value>
Removes a property from this node.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
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
Mutably borrows from an owned value. Read more