use super::{RawDhcpOption, DhcpOptionError}; use crate::options::DhcpOption; pub struct TimeOffset; impl DhcpOption for TimeOffset { const CODE: u8 = 2; type Item = u32; fn parse(option: &RawDhcpOption) -> Result { (option.length == 4) .then_some(()) .ok_or(DhcpOptionError::InvalidLength(option.length, 4))?; Ok(u32::from_be_bytes( option.data[..4] .try_into() .expect("The parser pulled exactly 4 bytes"), )) } }