render
render
Section titled “render”Renders PlantUML source to the requested format. Dispatches to the appropriate renderer based on the FileFormat value.
Signature
Section titled “Signature”pub fn render(source: &str, format: FileFormat) -> Result<String, RenderError>use plantuml_engine::render;use plantuml_core::FileFormat;
let svg = render("@startuml\nAlice -> Bob: hello\n@enduml", FileFormat::Svg)?;let preproc = render("@startuml\nAlice -> Bob: hello\n@enduml", FileFormat::Preproc)?;Supported formats
Section titled “Supported formats”Currently supports FileFormat::Svg and FileFormat::Preproc. All other formats return RenderError::UnsupportedFormat.
Errors
Section titled “Errors”RenderError::ParseFailed— the source could not be parsed as a supported diagram type.RenderError::UnsupportedFormat(FileFormat)— the requested format is not yet implemented.RenderError::Utf8— the rendered output was not valid UTF-8.