Skip to content

Encode u32 as i64 #94

@marcelbuesing

Description

@marcelbuesing

What do you think about encoding u32 as i64?
I currently have the issue that I basically generate my Rust code from protobuf definitions, which I then want to decode and encode using bson. Now changing all protobuf defintions to i32 just because bson does not support unsigned ints does not seem really reasonable to me. I know this does not cover the u64, downside I guess is here the inconsistency.

fn serialize_u32(self, value: u32) -> EncoderResult<Bson> {
        Ok(Bson::I64(value as i64))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions