HydroGraphWrite

Trait HydroGraphWrite 

Source
pub trait HydroGraphWrite {
    type Err: Error;

    // Required methods
    fn write_prologue(&mut self) -> Result<(), Self::Err>;
    fn write_node_definition(
        &mut self,
        node_id: usize,
        node_label: &NodeLabel,
        node_type: HydroNodeType,
        location_id: Option<usize>,
        location_type: Option<&str>,
    ) -> Result<(), Self::Err>;
    fn write_edge(
        &mut self,
        src_id: usize,
        dst_id: usize,
        edge_type: HydroEdgeType,
        label: Option<&str>,
    ) -> Result<(), Self::Err>;
    fn write_location_start(
        &mut self,
        location_id: usize,
        location_type: &str,
    ) -> Result<(), Self::Err>;
    fn write_node(&mut self, node_id: usize) -> Result<(), Self::Err>;
    fn write_location_end(&mut self) -> Result<(), Self::Err>;
    fn write_epilogue(&mut self) -> Result<(), Self::Err>;
}
Expand description

Trait for writing textual representations of Hydro IR graphs, i.e. mermaid or dot graphs.

Required Associated Types§

Source

type Err: Error

Error type emitted by writing.

Required Methods§

Source

fn write_prologue(&mut self) -> Result<(), Self::Err>

Begin the graph. First method called.

Source

fn write_node_definition( &mut self, node_id: usize, node_label: &NodeLabel, node_type: HydroNodeType, location_id: Option<usize>, location_type: Option<&str>, ) -> Result<(), Self::Err>

Write a node definition with styling.

Source

fn write_edge( &mut self, src_id: usize, dst_id: usize, edge_type: HydroEdgeType, label: Option<&str>, ) -> Result<(), Self::Err>

Write an edge between nodes with optional labeling.

Source

fn write_location_start( &mut self, location_id: usize, location_type: &str, ) -> Result<(), Self::Err>

Begin writing a location grouping (process/cluster).

Source

fn write_node(&mut self, node_id: usize) -> Result<(), Self::Err>

Write a node within a location.

Source

fn write_location_end(&mut self) -> Result<(), Self::Err>

End writing a location grouping.

Source

fn write_epilogue(&mut self) -> Result<(), Self::Err>

End the graph. Last method called.

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + HydroGraphWrite + ?Sized> HydroGraphWrite for &'a mut T

Source§

type Err = <T as HydroGraphWrite>::Err

Source§

fn write_prologue(&mut self) -> Result<(), Self::Err>

Source§

fn write_node_definition( &mut self, node_id: usize, node_label: &NodeLabel, node_type: HydroNodeType, location_id: Option<usize>, location_type: Option<&str>, ) -> Result<(), Self::Err>

Source§

fn write_edge( &mut self, src_id: usize, dst_id: usize, edge_type: HydroEdgeType, label: Option<&str>, ) -> Result<(), Self::Err>

Source§

fn write_location_start( &mut self, location_id: usize, location_type: &str, ) -> Result<(), Self::Err>

Source§

fn write_node(&mut self, node_id: usize) -> Result<(), Self::Err>

Source§

fn write_location_end(&mut self) -> Result<(), Self::Err>

Source§

fn write_epilogue(&mut self) -> Result<(), Self::Err>

Source§

impl<T: HydroGraphWrite + ?Sized> HydroGraphWrite for Box<T>

Source§

type Err = <T as HydroGraphWrite>::Err

Source§

fn write_prologue(&mut self) -> Result<(), Self::Err>

Source§

fn write_node_definition( &mut self, node_id: usize, node_label: &NodeLabel, node_type: HydroNodeType, location_id: Option<usize>, location_type: Option<&str>, ) -> Result<(), Self::Err>

Source§

fn write_edge( &mut self, src_id: usize, dst_id: usize, edge_type: HydroEdgeType, label: Option<&str>, ) -> Result<(), Self::Err>

Source§

fn write_location_start( &mut self, location_id: usize, location_type: &str, ) -> Result<(), Self::Err>

Source§

fn write_node(&mut self, node_id: usize) -> Result<(), Self::Err>

Source§

fn write_location_end(&mut self) -> Result<(), Self::Err>

Source§

fn write_epilogue(&mut self) -> Result<(), Self::Err>

Implementors§