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§
Sourcefn as_plantuml<W: Write>(
&self,
writer: &mut W,
mode: &UmlGenerationMode,
) -> Result<(), UmlConverterError>
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 tomode- The generation mode specifying what content to include in the diagram
§Returns
Result<(), UmlConverterError>- Ok if successful, Err with details on failure
Provided Methods§
Sourcefn as_image<W: Write, P: AsRef<Path>>(
&self,
writer: &mut W,
image_format: ImageFormat,
mode: &UmlGenerationMode,
plantuml_path: P,
) -> Result<(), UmlConverterError>
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 toimage_format- The desired output format (PNG or SVG)mode- The generation mode specifying what content to includeplantuml_path- Path to the PlantUML jar file
§Returns
Result<(), UmlConverterError>- Ok if successful, Err with details on failure
Sourcefn save_uml_to_tempfile(
&self,
tempfile_path: &Path,
tempfile_name: &str,
mode: &UmlGenerationMode,
) -> Result<(), UmlConverterError>
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 createdtempfile_name- Name of the temporary file for error reportingmode- 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.