1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! This crate is a Rust library for using the [Serde](https://github.com/serde-rs/serde)
//! serialization framework with bencode data.
//!
//! # Examples
//!
//! ```
//! use serde_derive::{Serialize, Deserialize};
//!
//! #[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
//! struct Product {
//! name: String,
//! price: u32,
//! }
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let apple = Product {
//! name: "Apple".to_string(),
//! price: 130,
//! };
//!
//! let serialized = serde_bencode::to_string(&apple)?;
//!
//! // cspell:disable-next-line
//! assert_eq!(serialized, "d4:name5:Apple5:pricei130ee".to_string());
//!
//! let deserialized: Product = serde_bencode::from_str(&serialized)?;
//!
//! assert_eq!(
//! deserialized,
//! Product {
//! name: "Apple".to_string(),
//! price: 130,
//! }
//! );
//!
//! Ok(())
//! }
//! ```
pub use ;
pub use ;
pub use ;