Skip to main content

UmlConverter

Trait UmlConverter 

Source
pub trait UmlConverter {
    // Required method
    fn as_plantuml<W: Write>(
        &self,
        writer: &mut W,
        mode: &UmlGenerationMode,
    ) -> Result<(), UmlConverterError>;

    // Provided methods
    fn as_image<W: Write, P: AsRef<Path>>(
        &self,
        writer: &mut W,
        image_format: ImageFormat,
        mode: &UmlGenerationMode,
        plantuml_path: P,
    ) -> Result<(), UmlConverterError> { ... }
    fn save_uml_to_tempfile(
        &self,
        tempfile_path: &Path,
        tempfile_name: &str,
        mode: &UmlGenerationMode,
    ) -> Result<(), UmlConverterError> { ... }
}
Expand description

Trait for converting data structures to PlantUML format.

Implementors of this trait can generate UML diagrams in PlantUML syntax and convert them to various image formats using PlantUML.

Required Methods§

Source

fn as_plantuml<W: Write>( &self, writer: &mut W, mode: &UmlGenerationMode, ) -> Result<(), UmlConverterError>

Converts the implementing type to PlantUML syntax and writes it to the given writer.

§Arguments
  • writer - The writer to output the PlantUML code to
  • mode - The generation mode specifying what content to include in the diagram
§Returns
  • Result<(), UmlConverterError> - Ok if successful, Err with details on failure

Provided Methods§

Source

fn as_image<W: Write, P: AsRef<Path>>( &self, writer: &mut W, image_format: ImageFormat, mode: &UmlGenerationMode, plantuml_path: P, ) -> Result<(), UmlConverterError>

Converts the implementing type to an image format using PlantUML.

This method generates a PlantUML diagram and uses the PlantUML jar to convert it to the specified image format (PNG or SVG).

§Arguments
  • writer - The writer to output the generated image data to
  • image_format - The desired output format (PNG or SVG)
  • mode - The generation mode specifying what content to include
  • plantuml_path - Path to the PlantUML jar file
§Returns
  • Result<(), UmlConverterError> - Ok if successful, Err with details on failure
Source

fn save_uml_to_tempfile( &self, tempfile_path: &Path, tempfile_name: &str, mode: &UmlGenerationMode, ) -> Result<(), UmlConverterError>

Saves the UML representation to a temporary file.

§Arguments
  • tempfile_path - Path where the temporary file should be created
  • tempfile_name - Name of the temporary file for error reporting
  • mode - The generation mode specifying what content to include
§Returns
  • Result<(), UmlConverterError> - Ok if successful, Err with details on failure

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§