| 7 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] |
| 8 | #[cfg_attr(test, derive(test_strategy::Arbitrary))] |
| 9 | pub struct Payload( |
| 10 | // 1024 ensures that we spill over into the second length byte while still having a good |
| 11 | // runtime performance. |
| 12 | #[cfg_attr( |
| 13 | test, |
| 14 | any(proptest::collection::size_range(0..1024).lift()), |
| 15 | map(|bytes: Vec<u8>| Bytes::from(bytes)) |
| 16 | )] |
| 17 | Bytes, |
| 18 | ); |
| 19 | |
| 20 | impl Payload { |
| 21 | pub const MAX_SIZE: usize = (u16::MAX as usize) - 32; |