Skip to main content

Edge

Struct Edge 

Source
pub struct Edge {
    pub from: String,
    pub to: String,
    pub from_subgraph: Option<String>,
    pub to_subgraph: Option<String>,
    pub label: Option<String>,
    pub stroke: Stroke,
    pub arrow_start: Arrow,
    pub arrow_end: Arrow,
    pub head_label: Option<String>,
    pub tail_label: Option<String>,
    pub minlen: i32,
    pub index: usize,
}
Expand description

An edge connecting two nodes.

Fields§

§from: String

Source node ID.

§to: String

Target node ID.

§from_subgraph: Option<String>

Original subgraph ID for the source endpoint, if the edge targeted a subgraph.

§to_subgraph: Option<String>

Original subgraph ID for the target endpoint, if the edge targeted a subgraph.

§label: Option<String>

Optional label on the edge.

§stroke: Stroke

Line style.

§arrow_start: Arrow

Arrow head at the start (source-side) of the edge.

§arrow_end: Arrow

Arrow head at the end (target-side) of the edge.

§head_label: Option<String>

Label near the target endpoint (head).

§tail_label: Option<String>

Label near the source endpoint (tail).

§minlen: i32

Minimum rank separation between source and target. Default 1.

§index: usize

Index of this edge in the diagram’s edge list. Assigned automatically by Diagram::add_edge().

Implementations§

Source§

impl Edge

Source

pub fn new(from: impl Into<String>, to: impl Into<String>) -> Self

Create a new edge with default style (solid line with arrow).

Source

pub fn with_label(self, label: impl Into<String>) -> Self

Set the label for this edge.

Source

pub fn with_stroke(self, stroke: Stroke) -> Self

Set the stroke style.

Source

pub fn with_arrow(self, arrow: Arrow) -> Self

Set the arrow type for the end (target-side) of the edge.

Source

pub fn with_arrows(self, start: Arrow, end: Arrow) -> Self

Set arrow types for both start and end.

Source

pub fn with_minlen(self, minlen: i32) -> Self

Set minimum rank separation (default 1). Use 0 for same-rank placement.

Trait Implementations§

Source§

impl Clone for Edge

Source§

fn clone(&self) -> Edge

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Edge

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Edge

Source§

fn eq(&self, other: &Edge) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Edge

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Edge

Source§

impl StructuralPartialEq for Edge

Auto Trait Implementations§

§

impl Freeze for Edge

§

impl RefUnwindSafe for Edge

§

impl Send for Edge

§

impl Sync for Edge

§

impl Unpin for Edge

§

impl UnsafeUnpin for Edge

§

impl UnwindSafe for Edge

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.