Modify read only data from parser

⚓ Rust    📅 2026-02-08    👤 surdeus    👁️ 8      

surdeus

I am working on a library that uses data- tags inside SVG files to embed extra data within them or flag specific tags that need their values filled in from data within the application. I then need to hand this data back to a library that is expecting a roxmltree::Document.

My current (non-working) though process is below:

  1. Parse SVG with roxmltree
  2. Convert to owned and mutable datatype
  3. Modify SVG file as necessary
  4. Convert back to roxmltree::Document
  5. Hand off roxmltree::Document to usvg parser which then gets handed off to rendering library

My current problem is implementing From<roxmltree::Document> for mylib::Tree because all of the data within Document are private fields, and only some of them have accessor methods. Not sure if the automatically implemented Into will even work with the private fields.

I am not particularly wedded to any part of this process currently, (especially as it is not working), but I have not found an alternate way to do this.

Any suggestions are appreciated.

Link to project if folks are interested: GitHub - sww1235/connection-diagram-manager at gui-dev

2 posts - 2 participants

Read full topic

🏷️ Rust_feed