ogrim 0.1.1

XML builder macro letting you write literal XML inside your Rust code (similar to `serde_json::json!`). Features interpolation, escaping, auto-close tags and minimal memory allocations.
Documentation
  • Coverage
  • 66.67%
    6 out of 9 items documented2 out of 5 items with examples
  • Size
  • Source code size: 36.35 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.83 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • elan-ev/ogrim
    10 2 5
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • LukasKalbertodt

ogrim: macro for building XML from inline XML

XML builder macro letting you write XML inside Rust code (similar to serde_json::json!). Features:

  • Value interpolation (with escaping of course)
    • Interpolate lists or optional attributes with <foo {..iter}>
  • Auto close tags for convenience (e.g. <foo>"body"</>)
  • Minimal memory allocations (only the String being built allocates)
  • Choice between minimized and pretty XML
use ogrim::xml;

let cat_name = "Tony";
let doc = xml!(
    <?xml version="1.0" ?>
    <zoo name="Lorem Ipsum" openingYear={2000 + 13}>
        <cat>{cat_name}</>
        <dog>"Barbara"</>
    </>
);

println!("{}", doc.as_str()); // Print XML

See the documentation for more information and examples.


License

Licensed under either of Apache License, Version 2.0 or MIT license at your option. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.