pub fn from_bytes(bytes: &[u8]) -> Result<Class> {
        if bytes.len() != HEADER_SIZE {
            let msg = format!("entry header too small: {}", bytes.len());
            return Err(ErrorKind::ParseFailure(msg).into());
        }

        let result = match NativeEndian::read_u32(bytes) {
            0 => Class::Root,
            1 => Class::Domain,
            2 => Class::OrgUnit,
            3 => Class::System,
            4 => Class::Credential,
            other => {
                let msg = format!("bad entry type: {}", other);
                return Err(ErrorKind::ParseFailure(msg).into());
            }
        };

        Ok(result)
    }
/// Deserialize an entry ID from its byte representation (host-native endianness)
Deserialize an entry ID from its byte representation (host-native endianness)
Deserialize an entry ID from its byte representation ( host - native endianness )
pub fn from_bytes(bytes: &[u8]) -> Result<Class> {
        if bytes.len() != HEADER_SIZE {
            let msg = format!("entry header too small: {}", bytes.len());
            return Err(ErrorKind::ParseFailure(msg).into());
        }
        let result = match NativeEndian::read_u32(bytes) {
            0 => Class::Root,
            1 => Class::Domain,
            2 => Class::OrgUnit,
            3 => Class::System,
            4 => Class::Credential,
            other => {
                let msg = format!("bad entry type: {}", other);
                return Err(ErrorKind::ParseFailure(msg).into());
            }
        };
        Ok(result)
    }
pub fn from_bytes ( bytes : & [ u8 ] ) -> Result < Class > { if bytes . len ( ) != HEADER_SIZE { let msg = format ! ( " " bytes len ( ) ) ; return Err ( ErrorKind :: ParseFailure ( msg ) . into ( ) ) ; } let result = match NativeEndian :: read_u32 ( bytes ) { 0 => Class :: Root , 1 => Class :: Domain , 2 => Class :: OrgUnit , 3 => Class :: System , 4 => Class :: Credential , other => { let msg = format ! ( " " other ) ; return Err ( ErrorKind :: ParseFailure ( msg ) . into ( ) ) ; } } ; Ok ( result ) }
Deserialize an entry ID from its byte representation (host-native endianness)
Deserialize an entry ID from its byte representation ( host - native endianness )
bytes
&[u8]
bytes
&[u8]