src/vrrpv2.rs
changeset 26 4ad31d279c35
parent 25 72c4d898c478
child 29 277a2f8b3653
equal deleted inserted replaced
25:72c4d898c478 26:4ad31d279c35
    49     VRRPv2AuthNoAuth = 0x00,
    49     VRRPv2AuthNoAuth = 0x00,
    50     VRRPv2AuthReserved1 = 0x01,
    50     VRRPv2AuthReserved1 = 0x01,
    51     VRRPv2AuthReserved2 = 0x02,
    51     VRRPv2AuthReserved2 = 0x02,
    52 }
    52 }
    53 
    53 
    54 trait ByteReader {
    54 trait BytesReader {
    55     fn read_u8(&mut self) -> io::Result<u8>;
    55     fn read_u8(&mut self) -> io::Result<u8>;
    56     fn read_u16(&mut self) -> io::Result<u16>;
    56     fn read_u16(&mut self) -> io::Result<u16>;
    57     fn read_u32(&mut self) -> io::Result<u32>;
    57     fn read_u32(&mut self) -> io::Result<u32>;
    58 }
    58 }
    59 
    59 
    60 impl<T: AsRef<[u8]>> ByteReader for Cursor<T> {
    60 impl<T: AsRef<[u8]>> BytesReader for Cursor<T> {
    61     fn read_u8(&mut self) -> io::Result<u8> {
    61     fn read_u8(&mut self) -> io::Result<u8> {
    62         let mut buffer = [0; 1];
    62         let mut buffer = [0; 1];
    63         self.read_exact(&mut buffer)?;
    63         self.read_exact(&mut buffer)?;
    64         Ok(u8::from_be_bytes(buffer))
    64         Ok(u8::from_be_bytes(buffer))
    65     }
    65     }