pub fn new(parent_id: EntryId, bytes: &[u8]) -> Result<DirEntry> {
        if bytes.len() < ENTRY_ID_SIZE {
            let msg = format!("direntry header too small: {}", bytes.len());
            return Err(ErrorKind::ParseFailure(msg).into());
        }

        let id = EntryId::from_bytes(&bytes[0..ENTRY_ID_SIZE])?;
        let name = str::from_utf8(&bytes[ENTRY_ID_SIZE..]).chain_err(
            || "couldn't parse direntry)",
        )?;

        Ok(DirEntry {
            id: id,
            parent_id: parent_id,
            name: name,
        })
    }
/// Parse a serialized directory entry into a DirEntry structure
Parse a serialized directory entry into a DirEntry structure
Parse a serialized directory entry into a DirEntry structure
pub fn new(parent_id: EntryId, bytes: &[u8]) -> Result<DirEntry> {
        if bytes.len() < ENTRY_ID_SIZE {
            let msg = format!("direntry header too small: {}", bytes.len());
            return Err(ErrorKind::ParseFailure(msg).into());
        }
        let id = EntryId::from_bytes(&bytes[0..ENTRY_ID_SIZE])?;
        let name = str::from_utf8(&bytes[ENTRY_ID_SIZE..]).chain_err(
            || "couldn't parse direntry)",
        )?;
        Ok(DirEntry {
            id: id,
            parent_id: parent_id,
            name: name,
        })
    }
pub fn new ( parent_id : EntryId , bytes : & [ u8 ] ) -> Result < DirEntry > { if bytes . len ( ) < ENTRY_ID_SIZE { let msg = format ! ( " " bytes len ( ) ) ; return Err ( ErrorKind :: ParseFailure ( msg ) . into ( ) ) ; } let id = EntryId :: from_bytes ( & bytes [ 0 .. ENTRY_ID_SIZE ] ) ? ; let name = str :: from_utf8 ( & bytes [ ENTRY_ID_SIZE .. ] ) . chain_err ( | | " " , ) ? ; Ok ( DirEntry { id : id , parent_id : parent_id , name : name , } ) }
Parse a serialized directory entry into a DirEntry structure
Parse a serialized directory entry into a DirEntry structure
parent_id
EntryId
bytes
&[u8]
parent_id
EntryId
bytes
&[u8]