pub struct Node {
pub id: u128,
pub label: String,
pub properties: Option<HashMap<String, Value>>,
}
Expand description
A node in the graph containing an ID, label, and property map. Properties are serialised without enum variant names in JSON format.
Fields§
§id: u128
The ID of the node.
This is not serialized when stored as it is the key.
label: String
The label of the node.
properties: Option<HashMap<String, Value>>
The properties of the node.
Properties are optional and can be None. Properties are serialised without enum variant names in JSON format.
Implementations§
Source§impl Node
impl Node
Sourcepub const NUM_PROPERTIES: usize = 2usize
pub const NUM_PROPERTIES: usize = 2usize
The number of properties in a node.
This is used as a constant in the return value mixin methods.
Sourcepub fn decode_node(bytes: &[u8], id: u128) -> Result<Node, GraphError>
pub fn decode_node(bytes: &[u8], id: u128) -> Result<Node, GraphError>
Decodes a node from a byte slice.
Takes ID as the ID is not serialized when stored as it is the key. Uses the known ID (either from the query or the key in an LMDB iterator) to construct a new node.
Sourcepub fn encode_node(&self) -> Result<Vec<u8>, GraphError>
pub fn encode_node(&self) -> Result<Vec<u8>, GraphError>
Encodes a node into a byte slice
This skips the ID and if the properties are None, it skips the properties.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Node
impl<'de> Deserialize<'de> for Node
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Filterable for Node
impl Filterable for Node
fn type_name(&self) -> FilterableType
fn id(&self) -> &u128
fn uuid(&self) -> String
fn label(&self) -> &str
fn from_node(&self) -> u128
fn from_node_uuid(&self) -> String
fn to_node(&self) -> u128
fn to_node_uuid(&self) -> String
fn vector_data(&self) -> &[f64]
fn score(&self) -> f64
fn properties(self) -> Option<HashMap<String, Value>>
fn properties_ref(&self) -> &Option<HashMap<String, Value>>
fn properties_mut(&mut self) -> &mut Option<HashMap<String, Value>>
fn check_property(&self, key: &str) -> Result<&Value, GraphError>
fn find_property<'a>( &'a self, key: &str, secondary_properties: &'a HashMap<String, ReturnValue>, property: &'a mut ReturnValue, ) -> Option<&'a ReturnValue>
Source§impl Ord for Node
impl Ord for Node
Source§impl PartialOrd for Node
impl PartialOrd for Node
impl Eq for Node
impl StructuralPartialEq for Node
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more