3Hren / 3Hren/msgpack-rust

Deserialize raw bytes into Vec<u8>

Open
#249 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.4k
Forks
162
PR merge metrics
No merged PRs in 30d

Description

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

```rust
#[test]
fn some_test() {
let b = rmp_serde::to_vec(&rmpv::Value::Binary(vec![0u8; 16])).unwrap();
let v: Vec = 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.