Expand description
Deterministic, security-bounded SVG to Excalidraw conversion.
The crate parses SVG or SVGZ bytes without external I/O, resolves SVG paint
semantics through usvg, and emits a typed Excalidraw v2 document. Use
convert for the deny-by-default path or convert_with_resources when
a caller intentionally provides bounded relative resources.
§Example
use svg2excal_core::{convert, ConversionOptions};
let svg = br##"<svg xmlns="http://www.w3.org/2000/svg" width="20" height="10">
<rect width="20" height="10" fill="#4dabf7"/>
</svg>"##;
let result = convert(svg, &ConversionOptions::default())?;
let json = result.document.to_pretty_json()?;
assert!(json.contains("\"type\": \"rectangle\""));Structs§
- Binary
File - Embedded Excalidraw binary file.
- Cancellation
Flag - Cooperative cancellation signal for synchronous conversions.
- Conversion
Diagnostic - One bounded, deterministic conversion diagnostic.
- Conversion
Limits - Hard security and output limits applied to every conversion stage.
- Conversion
Options - Complete conversion policy.
- Conversion
Report - Deterministic counts and decisions returned with a successful document.
- Conversion
Result - Complete successful conversion output.
- Excalidraw
AppState - Minimal stable Excalidraw application state.
- Excalidraw
Document - Typed Excalidraw v2 document.
- FileId
- Content-addressed Excalidraw binary-file identifier.
- Font
Options - Deterministic font-policy settings.
- Geometry
Options - Geometry approximation settings.
- GroupId
- Deterministic Excalidraw group identifier.
- Provided
Resource - Bytes and declared MIME returned by a provider.
- Raster
Options - Raster fallback settings.
- Relative
File Policy - Policy for caller-provided relative files.
- Resource
Context - Couples an allow policy and provider so callbacks cannot widen authority.
- Resource
Request - Validated request passed to a resource provider.
Enums§
- Conversion
Error - Fatal conversion error. No variant contains unbounded source text.
- Conversion
Profile - Policy used when the source cannot be represented exactly by native target elements.
- Diagnostic
Code - Stable diagnostic code.
- Diagnostic
Severity - Diagnostic severity ordered from informational through painted omission.
- Excalidraw
Element - Complete supported Excalidraw element union.
- Image
Mime Type - Supported embedded output MIME type.
- Input
Rejection - Input-format rejection categories.
- Limit
Resource - Resource whose hard bound was exceeded.
- Provenance
Mode - Controls compact source provenance attached to generated elements.
- Provided
Resource Policy - Core-enforced resource policy. V1 intentionally has no network variant.
- Resource
Error - Provider failure. Messages are fixed and contain no source path or bytes.
Traits§
- Resource
Provider - Synchronous object-safe bounded resource provider.
Functions§
- convert
- Converts SVG/SVGZ bytes without external I/O.
- convert_
with_ resources - Converts SVG/SVGZ bytes using an explicit bounded resource provider.