pub struct GraphLayout<N: Node> {
pub positions: HashMap<N, LayoutPosition>,
pub width: f64,
pub height: f64,
}Expand description
Computed graph layout: maps each node to its 2D position
Fields§
§positions: HashMap<N, LayoutPosition>Node → position mapping
width: f64Width of the layout canvas
height: f64Height of the layout canvas
Implementations§
Source§impl<N: Node + Clone> GraphLayout<N>
impl<N: Node + Clone> GraphLayout<N>
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of nodes in the layout
Sourcepub fn position(&self, node: &N) -> Option<&LayoutPosition>
pub fn position(&self, node: &N) -> Option<&LayoutPosition>
Get position for a node
Sourcepub fn set_position(&mut self, node: N, pos: LayoutPosition)
pub fn set_position(&mut self, node: N, pos: LayoutPosition)
Set position for a node
Trait Implementations§
Source§impl<N: Clone + Node> Clone for GraphLayout<N>
impl<N: Clone + Node> Clone for GraphLayout<N>
Source§fn clone(&self) -> GraphLayout<N>
fn clone(&self) -> GraphLayout<N>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<N> Freeze for GraphLayout<N>
impl<N> RefUnwindSafe for GraphLayout<N>where
N: RefUnwindSafe,
impl<N> Send for GraphLayout<N>
impl<N> Sync for GraphLayout<N>
impl<N> Unpin for GraphLayout<N>where
N: Unpin,
impl<N> UnsafeUnpin for GraphLayout<N>
impl<N> UnwindSafe for GraphLayout<N>where
N: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more