Skip to content

2B for Vec size instead of 1B as in bincode #94

@mentalblood0

Description

@mentalblood0
    #[derive(bitcode::Encode, bitcode::Decode, bincode::Encode, Debug)]
    struct TestStruct {
        key: Vec<u8>,
        value: Vec<u8>,
    }

    #[test]
    fn test_encoding() {
        let input = TestStruct {
            key: "key".as_bytes().to_vec(),
            value: "value".as_bytes().to_vec(),
        };
        {
            let encoded = bitcode::encode(&input);
            assert_eq!(encoded.len(), 12);
        }
        {
            let encoded = bincode::encode_to_vec(&input, bincode::config::standard()).unwrap();
            assert_eq!(encoded.len(), 10);
        }
    }

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