gbf_core::cfg_dot

Struct CfgDot

Source
pub struct CfgDot {
    pub config: CfgDotConfig,
}
Expand description

The main struct for rendering DOT graphs.

Fields§

§config: CfgDotConfig

The configuration for rendering the graph.

Implementations§

Source§

impl CfgDot

Source

pub fn render<R, N, E>(&self, graph: &DiGraph<N, E>, resolver: &R) -> String
where R: NodeResolver,

Renders the DOT representation of a DiGraph using the provided resolver.

This method:

  • Defines a directed graph (digraph CFG).
  • Applies graph-level and node-level styles from self.config.
  • Iterates over each node in the graph, resolving it via resolver.
  • Calculates the number of incoming edges for each node to create “ports” for the edges.
  • Constructs an HTML-like table label for each node with indentation to make it readable.
  • Iterates over all edges and connects them to the correct node ports.

The data.render_node(8) call uses an indentation of 8 spaces for the node’s content.

§Type Parameters
  • R - A type that implements NodeResolver.
  • N - Node weight type of the DiGraph.
  • E - Edge weight type of the DiGraph.
§Arguments
  • graph - The directed graph to render.
  • resolver - An object that resolves each node index to a data structure that can be rendered.
§Returns

A String containing the entire DOT (Graphviz) representation of the graph.

Auto Trait Implementations§

§

impl Freeze for CfgDot

§

impl RefUnwindSafe for CfgDot

§

impl Send for CfgDot

§

impl Sync for CfgDot

§

impl Unpin for CfgDot

§

impl UnwindSafe for CfgDot

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> 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, 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.