#[allow(unused_imports)]
use crate::util::FixedLengthFromBytes;
#[allow(unused_imports)]
use crate::util::FixedLengthSerialize;
#[allow(unused_imports)]
use crate::util::VariableLengthFromBytes;
#[allow(unused_imports)]
use crate::util::VariableLengthSerialize;
pub const EXTENSION_NAME: &str = "BIG-REQUESTS";
#[derive(Debug, Clone, PartialEq, Copy)]
pub struct EnableReply {
pub response_type: u8,
pub sequence: u16,
pub length: u32,
pub maximum_request_length: u32,
}
impl FixedLengthFromBytes<12> for EnableReply {
#[inline]
fn from_bytes(bytes: &[u8]) -> crate::error::Result<Self> {
Ok(Self {
response_type: u8::from_bytes(bytes.get(0..1).ok_or(crate::error::Error::FromBytes)?)?,
sequence: u16::from_bytes(bytes.get(2..4).ok_or(crate::error::Error::FromBytes)?)?,
length: u32::from_bytes(bytes.get(4..8).ok_or(crate::error::Error::FromBytes)?)?,
maximum_request_length: u32::from_bytes(
bytes.get(8..12).ok_or(crate::error::Error::FromBytes)?,
)?,
})
}
}