pub struct Connection<'a> { /* private fields */ }Implementations§
Source§impl<'a> Connection<'a>
impl<'a> Connection<'a>
pub fn new( from_node: NodeId, from_port: PortId, to_node: NodeId, to_port: PortId, ) -> Self
pub fn from_node(&self) -> NodeId
pub fn from_port(&self) -> PortId
pub fn to_node(&self) -> NodeId
pub fn to_port(&self) -> PortId
pub fn with_line_type(self, line_type: LineType) -> Self
pub fn line_type(&self) -> LineType
pub fn with_line_style(self, line_style: Style) -> Self
pub fn line_style(&self) -> Style
Sourcepub fn with_label(self, label: &'a str) -> Self
pub fn with_label(self, label: &'a str) -> Self
Attach a label to this connection, rendered horizontally at the midpoint of the routed path on top of the line (with a solid background so the line stays readable under the text).
Labels are purely opt-in: a connection built without with_label has
label == None and renders identically to a label-less graph.
The label is borrowed for the connection’s lifetime 'a, so Connection
stays Copy and can be used exactly as before (add_connection,
.copied(), etc.). Passing a &'static str is the common case.
The label text is truncated on screen to fit (see label); in
vertical layouts (Ttb/Btt) it is still written horizontally (the
terminal cannot rotate text), which may overlap neighbouring nodes —
this is an accepted visual compromise.
Trait Implementations§
Source§impl<'a> Clone for Connection<'a>
impl<'a> Clone for Connection<'a>
impl<'a> Copy for Connection<'a>
Auto Trait Implementations§
impl<'a> Freeze for Connection<'a>
impl<'a> RefUnwindSafe for Connection<'a>
impl<'a> Send for Connection<'a>
impl<'a> Sync for Connection<'a>
impl<'a> Unpin for Connection<'a>
impl<'a> UnsafeUnpin for Connection<'a>
impl<'a> UnwindSafe for Connection<'a>
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