-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confusion on how to read raw bytes #313
Comments
After you read the length with For example, assuming you read from some fn read_bin_to_vec(r: impl Read) -> Result<Vec<u8>> {
// First read the length of the following bin data
let len = rmp::decode::read_bin_len(&mut r)? as usize;
// Then allocate a vec with the read length and
// read the data into it
let mut buf = vec![0; len];
r.read_exact(&mut buf)?;
Ok(buf)
} I guess the reason for the missing Maybe you want to read into a fresh |
I'm creating a low-level, codec used by multiple languages using MsgPack.
RMP has this
encode
API:However, it has this
decode
API:I was expecting a symmetric
rmp::decode::read_bin(...)
.What's the idiomatic way to read raw bytes using the API?
The text was updated successfully, but these errors were encountered: