pub fn read_nrg_metadata(fd: &mut File) -> Result<NrgMetadata, NrgError> {
    let mut nm = NrgMetadata::new();

    // Get the file size
    nm.file_size = try!(fd.seek(SeekFrom::End(0)));

    // Get the NRG format from the footer
    nm.nrg_version = try!(read_nrg_version(fd, nm.file_size));
    if nm.nrg_version != 2 {
        // We handle only NRG v2
        return Err(NrgError::NrgFormat(
            "NRG v1 format is not handled".to_string()));
    }

    // Read the first chunk offset
    nm.chunk_offset = try!(read_u64(fd));

    // Read all the chunks
    try!(fd.seek(SeekFrom::Start(nm.chunk_offset)));
    try!(read_nrg_chunks(fd, &mut nm));

    Ok(nm)
}
/// Reads the metadata chunks from an open NRG image file `fd`.
///
/// `fd`'s offset can be anywhere when this function is called: it will be reset
/// before anything is read.
///
/// In case of success, `fd`'s offset will be left after the "END!" string of
/// the NRG footer. Otherwise, the offset is undefined and should be reset by
/// the caller if any additional reading operations are to be done.
Reads the metadata chunks from an open NRG image file `fd`.
`fd`'s offset can be anywhere when this function is called: it will be reset
before anything is read.

In case of success, `fd`'s offset will be left after the "END!" string of
the NRG footer. Otherwise, the offset is undefined and should be reset by
the caller if any additional reading operations are to be done.
Reads the metadata chunks from an open NRG image file ` fd ` . ` fd ` ' s offset can be anywhere when this function is called : it will be reset before anything is read . In case of success ` fd ` ' s offset will be left after the " END! " string of the NRG footer . Otherwise the offset is undefined and should be reset by the caller if any additional reading operations are to be done .
pub fn read_nrg_metadata(fd: &mut File) -> Result<NrgMetadata, NrgError> {
    let mut nm = NrgMetadata::new();
    // Get the file size
    nm.file_size = try!(fd.seek(SeekFrom::End(0)));
    // Get the NRG format from the footer
    nm.nrg_version = try!(read_nrg_version(fd, nm.file_size));
    if nm.nrg_version != 2 {
        // We handle only NRG v2
        return Err(NrgError::NrgFormat(
            "NRG v1 format is not handled".to_string()));
    }
    // Read the first chunk offset
    nm.chunk_offset = try!(read_u64(fd));
    // Read all the chunks
    try!(fd.seek(SeekFrom::Start(nm.chunk_offset)));
    try!(read_nrg_chunks(fd, &mut nm));
    Ok(nm)
}
pub fn read_nrg_metadata ( fd : & mut File ) -> Result < NrgMetadata , NrgError > { let mut nm = NrgMetadata :: new ( ) ; // Get the file size nm . file_size = try ! ( fd seek ( SeekFrom End ( 0 ) ) ) ; // Get the NRG format from the footer nm . nrg_version = try ! ( read_nrg_version ( fd nm file_size ) ) ; if nm . nrg_version != 2 { // We handle only NRG v2 return Err ( NrgError :: NrgFormat ( " " . to_string ( ) ) ) ; } // Read the first chunk offset nm . chunk_offset = try ! ( read_u64 ( fd ) ) ; // Read all the chunks try ! ( fd seek ( SeekFrom Start ( nm chunk_offset ) ) ) ; try ! ( read_nrg_chunks ( fd mut nm ) ) ; Ok ( nm ) }
Reads the metadata chunks from an open NRG image file `fd`.
Reads the metadata chunks from an open NRG image file ` fd ` .
fd
&mut File
fd
&mut File