pub struct NodeName(/* private fields */);Expand description
A node’s name within its graph, which is also its identity.
Nodes deliberately have no hidden ids: a readable DSL requires referring to a node by name. The price is that renaming becomes a refactor that rewrites every reference, exactly as in any programming language.
Implementations§
Source§impl NodeName
impl NodeName
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Normalizes to NFC, as Rust does for its own identifiers.
é typed directly and e followed by a combining acute are the same
name to a reader and different byte strings to a BTreeMap. macOS
filesystems and several input methods emit the decomposed form, so
without this two people on different machines can write what looks like
the same node name and get two nodes — in a format whose entire job is
surviving merges between exactly those machines.
pub fn as_str(&self) -> &str
Trait Implementations§
Source§impl Borrow<str> for NodeName
Lets a BTreeMap<NodeName, _> be probed with a plain &str.
impl Borrow<str> for NodeName
Lets a BTreeMap<NodeName, _> be probed with a plain &str.
Sound because NodeName’s Ord and Eq are the wrapped String’s. Callers
that may hold a denormalized name still have to go through NodeName::new;
see [Graph::node] for how that is kept cheap.