Closed katyo closed 6 years ago
Oh, I already found solution. Please, close this issue.
Hi, what solution you've found?
For future reference: You can annotate struct fields with #[serde(with = "serde_bytes")]
from the serde_bytes-crate.
For example:
#[derive(Serialize, Deserialize)]
pub struct File {
pub length: i64,
#[serde(rename = "pieces root")]
#[serde(with = "serde_bytes")]
pub pieces_root: Vec<u8>,
}
I would like to use this library to handle BT DHT messages. I represent some fields (like TransactionId, NodeId) as Vec but I see that it encoded as arrays of integers, not as byte strings as expected. I don't sure that it is a wrong behavior, but I need a way to fix it.