pub struct HexNode {
pub id: NodeId,
pub layer: Layer,
pub role: Role,
pub type_name: String,
pub module_path: String,
pub metadata: HashMap<String, String>,
}Expand description
Represents a component node in the hexagonal architecture graph.
Nodes are immutable and contain all metadata about a component including its architectural layer, role, type information, and custom metadata.
§Example
use hexser::graph::{HexNode, NodeId, Layer, Role};
let node = HexNode::new(
NodeId::from_name("MyEntity"),
Layer::Domain,
Role::Entity,
"MyEntity",
"my_crate::domain",
);Fields§
§id: NodeIdUnique identifier for this node.
layer: LayerArchitectural layer this component belongs to.
role: RoleRole this component plays within its layer.
type_name: StringType name of the component (e.g., “UserRepository”).
module_path: StringModule path where the component is defined.
metadata: HashMap<String, String>Additional metadata about this node.
Implementations§
Source§impl HexNode
impl HexNode
Sourcepub fn new(
id: NodeId,
layer: Layer,
role: Role,
type_name: &str,
module_path: &str,
) -> Self
pub fn new( id: NodeId, layer: Layer, role: Role, type_name: &str, module_path: &str, ) -> Self
Create a new HexNode with the specified properties.
Sourcepub fn with_metadata(
id: NodeId,
layer: Layer,
role: Role,
type_name: &str,
module_path: &str,
metadata: HashMap<String, String>,
) -> Self
pub fn with_metadata( id: NodeId, layer: Layer, role: Role, type_name: &str, module_path: &str, metadata: HashMap<String, String>, ) -> Self
Create a new HexNode with metadata.
Sourcepub fn module_path(&self) -> &str
pub fn module_path(&self) -> &str
Get the module path.
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 is_in_layer(&self, layer: Layer) -> bool
pub fn is_in_layer(&self, layer: Layer) -> bool
Check if this node is in a specific layer.
Trait Implementations§
Source§impl Describable for HexNode
impl Describable for HexNode
Source§impl Inspectable for HexNode
impl Inspectable for HexNode
Source§fn layer_info(&self) -> LayerInfo
fn layer_info(&self) -> LayerInfo
Returns the layer this component belongs to.
Source§fn dependencies(&self) -> Vec<NodeId>
fn dependencies(&self) -> Vec<NodeId>
Returns a list of component IDs this depends on.
Source§fn dependents(&self) -> Vec<NodeId>
fn dependents(&self) -> Vec<NodeId>
Returns a list of component IDs that depend on this.
impl Eq for HexNode
impl StructuralPartialEq for HexNode
Auto Trait Implementations§
impl Freeze for HexNode
impl RefUnwindSafe for HexNode
impl Send for HexNode
impl Sync for HexNode
impl Unpin for HexNode
impl UnwindSafe for HexNode
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