serde-bencode
serde-bencode copied to clipboard
Serde backed Bencode encoding/decoding library for Rust.
What do you think of a RawValue type like in [serde_json](https://docs.serde.rs/serde_json/value/struct.RawValue.html)? ## Use case I want to use it to deserialize a Torrent struct without having to declare all the...
Fixes #28
This adds a https://github.com/rust-fuzz/cargo-fuzz fuzzer which I used to find #28
```rust use serde_bencode::value::Value; use serde_bencode::from_bytes; fn main() { let data = b"123456789123:1"; let _: Result = from_bytes(data); } ``` reproduced with git version (https://github.com/toby/serde-bencode/commit/553adb4be4962afcf30c79fe51b1ec191546c7b9) and latest crates.io (0.2.3). The issue...
I think these two failing tests could be the same problem because they both use `#[serde(flatten)]` for an `enum` field. - `cargo test ser_de_flattened_enum -- --nocapture` - `cargo test ser_de_flattened_adjacently_tagged_enum...
Current coverage report: ```console Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover Branches Missed Branches Cover ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- de.rs 190 60 68.42% 36 9 75.00% 237...
It seems you can not deserialize a tuple struct like this `struct Node(String, i64)` from a nested list in encoded format. There are already two tests for this behavior. ```rust...
Some structs should be `pub(crate)`: - https://github.com/toby/serde-bencode/blob/master/src/de.rs#L13 - https://github.com/toby/serde-bencode/blob/master/src/ser.rs#L87 - https://github.com/toby/serde-bencode/blob/master/src/ser/string.rs#L24
I was trying to write the PR myself but the code is quite confusing for me sorry. The idea is that instead of a generic error: > Invalid Type: byte...
Currently I can deserialize HashMap with key as an enum as example bellow: ``` #[derive(PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)] enum Extension { #[serde(rename = "ut_metadata")] Metadata, } serde_bencode::from_str::("d11:ut_metadatai1ee").unwrap(); ``` But...