pub fn add_node<T>(&mut self, name: impl Into<Cow<'static, str>>, node: T) -> NodeId
    where
        T: Node,
    {
        let id = NodeId::new();
        let name = name.into();
        let mut node_state = NodeState::new(id, node);
        node_state.name = Some(name.clone());
        self.nodes.insert(id, node_state);
        self.node_names.insert(name, id);
        id
    }
/// Adds the `node` with the `name` to the graph.
/// If the name is already present replaces it instead.
Adds the `node` with the `name` to the graph.
If the name is already present replaces it instead.
Adds the ` node ` with the ` name ` to the graph . If the name is already present replaces it instead .
pub fn add_node<T>(&mut self, name: impl Into<Cow<'static, str>>, node: T) -> NodeId
    where
        T: Node,
    {
        let id = NodeId::new();
        let name = name.into();
        let mut node_state = NodeState::new(id, node);
        node_state.name = Some(name.clone());
        self.nodes.insert(id, node_state);
        self.node_names.insert(name, id);
        id
    }
pub fn add_node < T > ( & mut self , name : impl Into < Cow < ' static , str > > , node : T ) -> NodeId where T : Node , { let id = NodeId :: new ( ) ; let name = name . into ( ) ; let mut node_state = NodeState :: new ( id , node ) ; node_state . name = Some ( name . clone ( ) ) ; self . nodes . insert ( id , node_state ) ; self . node_names . insert ( name , id ) ; id }
Adds the `node` with the `name` to the graph.
Adds the ` node ` with the ` name ` to the graph .
&mut self
name
impl Into<Cow<'static, str>>
node
T
&mut self
name
impl Into<Cow<'static, str>>
node
T