Skip to content

#[deku(as = "")]/#[deku(with = "")] attributes #225

Open
@coolreader18

Description

@coolreader18

Sort-of related to #174, but more general.

I'm looking into converting RustPython's bytecode format to use deku over bincode (RustPython/RustPython#2362 (comment)), and I'm running into a few issues cause I want to keep the DekuRead/Write structs roughly as they are, i.e. ergonomic to use from Rust. For example, not adding separate length fields for deserializing vectors, and also I'd like to use LEB128 to represent most integers as our existing bincode impl does. I understand why those aren't defaults in deku, but it'd be a lot easier to customize deku to meet our needs if there was something like serde's with attribute, or even serde_with's as attribute. Would you accept a PR that adds Deku{Read/Write}As traits and an as attribute to the derive macros so that individual field [de]serializing can be customized? I might just base it off serde_with's design, since I think that seems to work well.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions