Consider passing around Vec<ASN1Block> instead of slices in FromASN1 #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This would allow for allocation-less parsing. Currently it's required to clone data from the ASN1Blocks to move it into domain objects.
OK, now that I'm looking at this, I'm not sure I understand your concern. Do you have an example you can share?
In particular, the library passes around slices specifically to avoid having to do deep copies. So the only thing that should be being duplicated is a ptr/start/end construct, not the
ASN1Blocks within it. I did a quick check to validate this; I removed theClonederive onASN1Block, and it didn't appear to have much of an effect either on the library (messed with the tests, but that's it) or a little x509 library I've been building around this one. But maybe I'm missing a critical use case?I meant in the
FromASN1andToASN1traits. Seee6c4958eb3/src/key.rs (L85-L86)Sorry for the delay in responding. I was waiting for the ability to make my work public so I could share the issue I was having.
I either need to be able to thread a lifetime through during deserialization or be able to pop off ASN1Blocks and move the memory inside of the struct.
Also we can definitely macro this up. Would you mind me contributing some derive macros for
ToASN1andFromASN1?OK, I get it. I'm not sure what the best way forward is, but I'm currently thinking something like a mutable iterator. Let me play around with it.
Also, I'd be happy to accept derive macros.