pub struct Edge<T> {
pub id: EdgeID,
pub from: NodeID,
pub to: NodeID,
pub data: T,
}
Expand description
§A struct representing an edge in the graph.
Contains an EdgeID which is a key to the edge in the slotmap, and two NodeIDs which are the nodes the edge connects (from & to). An edge can also have “data”, which could be anything or nothing; for example the weight of the connection or a struct or enum representing something else.
§Why is there no “EdgeTrait”?
The Edge struct is very simple and doesn’t need a trait. It’s just a struct with an ID, two node IDs, and some data. If you want to add more functionality or data to the edge you can probably just add it to the data field, or add an edge as a field to your custom type.
Fields§
§id: EdgeID
§from: NodeID
§to: NodeID
§data: T
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Edge<T>where
T: Freeze,
impl<T> RefUnwindSafe for Edge<T>where
T: RefUnwindSafe,
impl<T> Send for Edge<T>where
T: Send,
impl<T> Sync for Edge<T>where
T: Sync,
impl<T> Unpin for Edge<T>where
T: Unpin,
impl<T> UnwindSafe for Edge<T>where
T: UnwindSafe,
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