Skip to content

Deserialize raw bytes into Vec<u8> #249

@jeromegn

Description

@jeromegn

Maybe I missed it, but I'm unable to deserialize a raw binary value as a Vec<u8>:

    #[test]
    fn some_test() {
        let b = rmp_serde::to_vec(&rmpv::Value::Binary(vec![0u8; 16])).unwrap();
        let v: Vec<u8> = rmp_serde::from_read_ref(&b).unwrap();
    }
running 1 test
thread 'tests::some_test' panicked at 'called `Result::unwrap()` on an `Err` value: Syntax("invalid type: byte array, expected a sequence")', src/lib.rs:503:26
stack backtrace:
< not relevant >

AFAICT, it's the same issue with fixed arrays.

The only work around is to use rmp_serde::Raw, but that seems odd.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions