pub struct HexEdge {
pub source: NodeId,
pub target: NodeId,
pub relationship: Relationship,
pub metadata: HashMap<String, String>,
}Expand description
Represents a directed edge between two nodes in the graph.
Edges capture relationships between components such as “implements”, “depends on”, “transforms”, etc. They are immutable and contain metadata about the relationship.
§Example
use hexser::graph::{HexEdge, NodeId, Relationship};
let edge = HexEdge::new(
NodeId::from_name("PostgresRepo"),
NodeId::from_name("UserRepository"),
Relationship::Implements,
);Fields§
§source: NodeIdSource node of this edge.
target: NodeIdTarget node of this edge.
relationship: RelationshipType of relationship this edge represents.
metadata: HashMap<String, String>Additional metadata about this edge.
Implementations§
Source§impl HexEdge
impl HexEdge
Sourcepub fn new(source: NodeId, target: NodeId, relationship: Relationship) -> Self
pub fn new(source: NodeId, target: NodeId, relationship: Relationship) -> Self
Create a new HexEdge between two nodes.
Sourcepub fn with_metadata(
source: NodeId,
target: NodeId,
relationship: Relationship,
metadata: HashMap<String, String>,
) -> Self
pub fn with_metadata( source: NodeId, target: NodeId, relationship: Relationship, metadata: HashMap<String, String>, ) -> Self
Create a new HexEdge with metadata.
Sourcepub fn relationship(&self) -> Relationship
pub fn relationship(&self) -> Relationship
Get the relationship type.
Sourcepub fn get_metadata(&self, key: &str) -> Option<&String>
pub fn get_metadata(&self, key: &str) -> Option<&String>
Get a metadata value by key.
Sourcepub fn has_relationship(&self, rel: Relationship) -> bool
pub fn has_relationship(&self, rel: Relationship) -> bool
Check if this edge has a specific relationship type.
Trait Implementations§
impl Eq for HexEdge
impl StructuralPartialEq for HexEdge
Auto Trait Implementations§
impl Freeze for HexEdge
impl RefUnwindSafe for HexEdge
impl Send for HexEdge
impl Sync for HexEdge
impl Unpin for HexEdge
impl UnwindSafe for HexEdge
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