Skip to main content

SubgraphBorder

Enum SubgraphBorder 

Source
#[non_exhaustive]
pub enum SubgraphBorder { Double, Light, Dashed, None, }
Expand description

Subgraph (cluster) box border style.

None is not “invisible cluster” — the box still groups its nodes for layout and its label still paints; only the border ink is suppressed.

use ascii_dag::{Graph, RenderOptions};
use ascii_dag::render::engine::{SubgraphBorder, SubgraphStyle, SubgraphStyleCtx};

fn borderless(_ctx: SubgraphStyleCtx<'_>) -> SubgraphStyle {
    SubgraphStyle { border: SubgraphBorder::None, ..SubgraphStyle::default() }
}

let mut g = Graph::new();
g.add_node(1, "A");
g.add_node(2, "B");
g.add_edge(1, 2, None);
let sg = g.add_subgraph("Group");
g.put_nodes(&[1]).inside(sg).unwrap();

let mut options = RenderOptions::plain();
options.plan.subgraph_style_fn = borderless;
let text = g.compute_layout().render_string(&options);
assert!(!text.contains('╔'));      // no border ink
assert!(text.contains("Group"));   // label still there

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Double

Double strokes (═ ║) — the default (legacy).

§

Light

Light strokes (─ │).

§

Dashed

Dashed strokes (┈ ┊).

§

None

No border — the cluster groups its nodes without ink (its label still paints when it fits).

Trait Implementations§

Source§

impl Clone for SubgraphBorder

Source§

fn clone(&self) -> SubgraphBorder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for SubgraphBorder

Source§

impl Debug for SubgraphBorder

Source§

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

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

impl Default for SubgraphBorder

Source§

fn default() -> SubgraphBorder

Returns the “default value” for a type. Read more
Source§

impl Eq for SubgraphBorder

Source§

impl PartialEq for SubgraphBorder

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SubgraphBorder

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.