mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 02:05:30 +00:00
aquatic_http: add hand-written ScrapeResponse serialization
This commit is contained in:
parent
17385c92ad
commit
84facea0ca
4 changed files with 94 additions and 26 deletions
|
|
@ -15,7 +15,7 @@ pub struct PeerId(
|
|||
);
|
||||
|
||||
|
||||
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Serialize)]
|
||||
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize)]
|
||||
#[serde(transparent)]
|
||||
pub struct InfoHash(
|
||||
#[serde(
|
||||
|
|
@ -53,4 +53,19 @@ impl FromStr for AnnounceEvent {
|
|||
value => Err(format!("Unknown value: {}", value))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
impl quickcheck::Arbitrary for InfoHash {
|
||||
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self {
|
||||
let mut arr = [b'x'; 20];
|
||||
|
||||
arr[0] = u8::arbitrary(g);
|
||||
arr[1] = u8::arbitrary(g);
|
||||
arr[18] = u8::arbitrary(g);
|
||||
arr[19] = u8::arbitrary(g);
|
||||
|
||||
Self(arr)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue