Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

#[bincode(bound)] for generic types #511

@coolreader18

Description

@coolreader18

I'm looking into switching to bincode v2 and I'd love to get rid of serde - the only thing that seems to be lacking in the derive macros is that I can't specify custom bounds for generics. e.g.:

#[derive(Encode, Decode)]
struct A<B: MyTrait> {
    foo: usize,
    b: B,
    thing: B::Assoc,
}

With serde, I had a #[serde(bound(deserialize = "B::Assoc: serde::Deserialize<'de>", serialize = "B::Assoc: serde::Serialize"))]; it'd be awesome to have a similar feature for bincode v2's derive.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions