Replies: 7 comments 2 replies
-
This is due to the fact that one of my original goals for the project was to implement this in as close to a zero-copy way as possible given CBOR's (and presumably CDDL's) use in constrained computing environments. I assume you're compiling to the WASM target? If so, I can just created owned versions of these structs which are used when targeting WASM. Would that work? |
Beta Was this translation helpful? Give feedback.
-
Hey @itamarst, I need to think about this a bit more. Creating owned versions of everything will add quite a bit of duplication and extra work, which I don't feel is worth it just to work around PyO3's limitations for using lifetimes. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Oh, |
Beta Was this translation helpful? Give feedback.
-
Yea, gonna move this to a Discussion and gauge interest for now. It's unclear, even to me, what the embedded/ |
Beta Was this translation helpful? Give feedback.
-
What if struct CDDL<B: AsRef<[u8]>> {...} I think this might support all the options, looking at https://doc.rust-lang.org/std/convert/trait.AsRef.html#implementors? |
Beta Was this translation helpful? Give feedback.
-
OK, I figured out the solution (without requiring changes on your side): https://docs.rs/ouroboros/latest/ouroboros/attr.self_referencing.html allowed me to store both the |
Beta Was this translation helpful? Give feedback.
-
I am wrapping the library with Python, using PyO3. PyO3's macros for wrapping classes aren't happy with having a lifetime parameter, so having a
CDDL
attribute is difficult (I don't want to parse the schema from scratch each time I validate a document).More broadly, having a lifetime identifier on the
CDDL
struct just makes using it annoying since it percolates to everything.I am very much not an expert, but I suspect this could be fixed simply by having the parser own the lexer and the original schema string?
Beta Was this translation helpful? Give feedback.
All reactions