DiagramProvider

Trait DiagramProvider 

Source
pub trait DiagramProvider {
    // Required methods
    fn validate(&self, source: &str) -> DiagramResult<()>;
    fn generate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        source: &'life1 str,
        format: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = DiagramResult<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

A trait for diagram generation providers.

Each provider implementation is responsible for a specific diagram type (e.g., Mermaid, Graphviz).

Required Methods§

Source

fn validate(&self, source: &str) -> DiagramResult<()>

Validates the diagram source text.

Returns Ok(()) if the source is valid, or an error otherwise.

Source

fn generate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source: &'life1 str, format: &'life2 str, ) -> Pin<Box<dyn Future<Output = DiagramResult<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Generates a diagram image from the source text.

§Arguments
  • source - The diagram description text.
  • format - The desired output format (e.g., “svg”, “png”).

Returns a Vec<u8> containing the image data.

Implementors§