pub struct Graph { /* private fields */ }Expand description
The whole model: every node, looked up by id. BTreeMap again, so iteration is in id order, which is exactly the order the spec requires for output.
Implementations§
Source§impl Graph
impl Graph
Sourcepub fn insert(&mut self, node: Node) -> Result<(), Node>
pub fn insert(&mut self, node: Node) -> Result<(), Node>
Add a node. If the id is already taken the existing node is kept (“first wins”, the
spec’s duplicate rule) and the rejected node is handed back in Err.
Sourcepub fn get(&self, id: &str) -> Option<&Node>
pub fn get(&self, id: &str) -> Option<&Node>
Look a node up. Returns a borrowed reference, not a copy: Option<&Node>.
Sourcepub fn scratch_of<'a>(&'a self, node: &'a Node) -> Option<&'a str>
pub fn scratch_of<'a>(&'a self, node: &'a Node) -> Option<&'a str>
The scratch plane a node sits in, if it is in one: its plane names a plane node with fields.scratch: true.
A scratch is a sandbox: rules skip its nodes and nothing outside it may link to or parent them.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnsafeUnpin for Graph
impl UnwindSafe for Graph
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