docs.rs failed to build milsymbol-rs-0.3.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
milsymbol-rs
A Rust wrapper for the milsymbol JavaScript library, enabling the generation of military symbols (MIL-STD-2525 and APP-6) as SVG strings or static images directly from Rust.
This crate uses deno_core to evaluate the optimized JavaScript library within the V8 engine and returns representations suitable for UI frameworks, GIS applications, or for web use.
Compatibility
| milsymbol-rs | milsymbol-js |
|---|---|
| ^0.1 - ^0.2 | 3.0.4 |
Features
- Full Milsymbol Support: Generate any symbol supported by the original library.
- Static Image Rendering: (Default enabled) Render symbols directly to
image::DynamicImageusingresvg. - Builder Pattern: Ergonomic and typed configuration of symbol options.
- In-Memory Caching: (Default enabled) Automatically caches rendered symbols to avoid re-executing JavaScript or rendering SVGs for identical inputs.
- Automated JS Build: The crate automatically handles the compilation of the
milsymbolJavaScript dependency during the Rust build process.npmis required. - Strongly Typed Errors: Comprehensive error handling using
thiserrorandeyre.
Basic Usage
use ;
Feature Flags
cache(default): Enables thread-safe in-memory caching of rendered SVGs and images.image(default): Enables static image rendering viaresvgandimagecrates.
Cache Management
When the cache feature is enabled, you can manage the in-memory cache on the Milsymbol instance:
ms.clear_cache(): Removes all entries from the cache for this engine instance.ms.remove_from_cache(sidc, options): Removes a specific symbol from the cache.
Development
The crate includes an automated build.rs script. To build the project, ensure you have npm installed, as it is used to bundle the JavaScript library submodule:
Examples
Run the provided examples to see the library in action:
License
This project is licensed under the MIT License - see the LICENSE file for details.