pub fn try_scan_from_file<T: Iterator<Item = u64>>(
        file: &mut File,
        range: T,
    ) -> Result<Self, Error>
    where
        T: RangeBounds<u64>,
    {
        let mut anchor = [0; 5];
        for offset in range.step_by(0x10) {
            file.seek(SeekFrom::Start(offset))?;
            file.read_exact(&mut anchor)?;
            if anchor == Self::SM3_ANCHOR {
                let mut length = [0; 2];
                file.read_exact(&mut length)?;
                let struct_length = length[1] as usize;
                let mut entry_point_buffer = Vec::with_capacity(struct_length);
                entry_point_buffer.resize(struct_length, 0);
                file.seek(SeekFrom::Start(offset))?;
                file.read_exact(&mut entry_point_buffer)?;
                let entry_point: Self = entry_point_buffer.try_into()?;
                return Ok(entry_point);
            }
        }
        Err(Error::new(ErrorKind::UnexpectedEof, "Not found"))
    }
/// Load this structure by scanning a file within the given offsets,
/// looking for the [SMBiosEntryPoint64::SM3_ANCHOR] string.
Load this structure by scanning a file within the given offsets,
looking for the [SMBiosEntryPoint64::SM3_ANCHOR] string.
Load this structure by scanning a file within the given offsets looking for the [ SMBiosEntryPoint64 :: SM3_ANCHOR ] string .
pub fn try_scan_from_file<T: Iterator<Item = u64>>(
        file: &mut File,
        range: T,
    ) -> Result<Self, Error>
    where
        T: RangeBounds<u64>,
    {
        let mut anchor = [0; 5];
        for offset in range.step_by(0x10) {
            file.seek(SeekFrom::Start(offset))?;
            file.read_exact(&mut anchor)?;
            if anchor == Self::SM3_ANCHOR {
                let mut length = [0; 2];
                file.read_exact(&mut length)?;
                let struct_length = length[1] as usize;
                let mut entry_point_buffer = Vec::with_capacity(struct_length);
                entry_point_buffer.resize(struct_length, 0);
                file.seek(SeekFrom::Start(offset))?;
                file.read_exact(&mut entry_point_buffer)?;
                let entry_point: Self = entry_point_buffer.try_into()?;
                return Ok(entry_point);
            }
        }
        Err(Error::new(ErrorKind::UnexpectedEof, "Not found"))
    }
pub fn try_scan_from_file < T : Iterator < Item = u64 > > ( file : & mut File , range : T , ) -> Result < Self , Error > where T : RangeBounds < u64 > , { let mut anchor = [ 0 ; 5 ] ; for offset in range . step_by ( 0x10 ) { file . seek ( SeekFrom :: Start ( offset ) ) ? ; file . read_exact ( & mut anchor ) ? ; if anchor == Self :: SM3_ANCHOR { let mut length = [ 0 ; 2 ] ; file . read_exact ( & mut length ) ? ; let struct_length = length [ 1 ] as usize ; let mut entry_point_buffer = Vec :: with_capacity ( struct_length ) ; entry_point_buffer . resize ( struct_length , 0 ) ; file . seek ( SeekFrom :: Start ( offset ) ) ? ; file . read_exact ( & mut entry_point_buffer ) ? ; let entry_point : Self = entry_point_buffer . try_into ( ) ? ; return Ok ( entry_point ) ; } } Err ( Error :: new ( ErrorKind :: UnexpectedEof , " " ) ) }
Load this structure by scanning a file within the given offsets,
looking for the [SMBiosEntryPoint64::SM3_ANCHOR] string.
Load this structure by scanning a file within the given offsets looking for the [ SMBiosEntryPoint64 :: SM3_ANCHOR ] string .
file
&mut File
range
T
file
&mut File
range
T