pub fn validate(&self, magic: [u8; 4], max_size: u32) -> Result<()> {
        if self.magic != magic {
            let msg = format!("Bad magic: {:?}", self.magic);
            return Err(Error::BadData(msg));
        }
        if self.payload_size > max_size {
            let msg = format!("Bad size: {:?}", self.payload_size);
            return Err(Error::BadData(msg));
        }
        Ok(())
    }
/// Checks if the header is valid
///
/// `magic` - Expected magic bytes for the network
/// `max_size` - Max size in bytes for the payload
Checks if the header is valid
`magic` - Expected magic bytes for the network
`max_size` - Max size in bytes for the payload
Checks if the header is valid ` magic ` - Expected magic bytes for the network ` max_size ` - Max size in bytes for the payload
pub fn validate(&self, magic: [u8; 4], max_size: u32) -> Result<()> {
        if self.magic != magic {
            let msg = format!("Bad magic: {:?}", self.magic);
            return Err(Error::BadData(msg));
        }
        if self.payload_size > max_size {
            let msg = format!("Bad size: {:?}", self.payload_size);
            return Err(Error::BadData(msg));
        }
        Ok(())
    }
pub fn validate ( & self , magic : [ u8 ; 4 ] , max_size : u32 ) -> Result < ( ) > { if self . magic != magic { let msg = format ! ( " " self magic ) ; return Err ( Error :: BadData ( msg ) ) ; } if self . payload_size > max_size { let msg = format ! ( " " self payload_size ) ; return Err ( Error :: BadData ( msg ) ) ; } Ok ( ( ) ) }
Checks if the header is valid
`magic` - Expected magic bytes for the network
`max_size` - Max size in bytes for the payload
Checks if the header is valid ` magic ` - Expected magic bytes for the network ` max_size ` - Max size in bytes for the payload
&self
magic
[u8; 4]
max_size
u32
&self
magic
[u8; 4]
max_size
u32