pub fn from_bytes<B: Buf>(mut bytes: B) -> Result<Self, std::io::Error> {
        if bytes.remaining() < 16 {
            return Err(std::io::Error::new(
                std::io::ErrorKind::UnexpectedEof,
                // copied from read_exact
                "failed to fill whole buffer",
            ));
        }
        let amount_received = bytes.get_u64();
        let max_amount = bytes.get_u64();
        Ok(MaxPacketAmountDetails::new(amount_received, max_amount))
    }
// Convert to use TryFrom? Also probably should go to max_packet_amount.rs
Convert to use TryFrom. Also probably should go to max_packet_amount.rs
Convert to use TryFrom . Also probably should go to max_packet_amount . rs
pub fn from_bytes<B: Buf>(mut bytes: B) -> Result<Self, std::io::Error> {
        if bytes.remaining() < 16 {
            return Err(std::io::Error::new(
                std::io::ErrorKind::UnexpectedEof,
                // copied from read_exact
                "failed to fill whole buffer",
            ));
        }
        let amount_received = bytes.get_u64();
        let max_amount = bytes.get_u64();
        Ok(MaxPacketAmountDetails::new(amount_received, max_amount))
    }
pub fn from_bytes < B : Buf > ( mut bytes : B ) -> Result < Self , std :: io :: Error > { if bytes . remaining ( ) < 16 { return Err ( std :: io :: Error :: new ( std :: io :: ErrorKind :: UnexpectedEof , // copied from read_exact " " , ) ) ; } let amount_received = bytes . get_u64 ( ) ; let max_amount = bytes . get_u64 ( ) ; Ok ( MaxPacketAmountDetails :: new ( amount_received , max_amount ) ) }
Convert to use TryFrom?
Convert to use TryFrom?
bytes
B
bytes
B