sax-wasm
sax-wasm copied to clipboard
Rust crate and changes to `EventListener` signature
Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Hi, I'm using sax-wasm from rust (it's great 🙏), I'm currently using git submodules, which is working fine, but clearly a proper rust crate would be ideal. (To be clear - a rust crate would be good long term, but I don't actually need it right now)
Secondly, I'm having some trouble setting up a "safe" way to collect nodes of an xml document in rust.
The problem is
pub type EventListener = fn(event: Event, data: &dyn Encode<Vec<u8>>);
The only way I can see to mutate an object in a function which matches this signature is to use a static mut and then unsafe, which isn't ideal.
Maybe I'm missing something obvious, but it would be great to be able to process "event/data"s and mutate a struct without resorting to unsafe.
Describe the solution you'd like A clear and concise description of what you want to happen.
I guess either:
- a
Iterinterface toSAXParser - or a compile time flag to change
EventListener - or maybe I'm missing some other solution
Let me know if the request is unclear and I can add specific examples.