pub struct Cell<T, A: Any + Copy> where
    T: BinRead<Args = A>, 
{ /* private fields */ }
Expand description

A Cell represents the most basic data structure of hive files. Nearly every other data is stored as content of a Cell.

As Cell is a generic, it receives two generic arguments:

  • T denotes the type contained in the Cell
  • A specifies the arguments required by binread to correctly parse an object of type T

Usage

If you know what kind of data should be stored in a certain Cell, you can simply read it. Assume you have Cell which should contain a KeyNode, you can read it as follows:

use nt_hive2::*;
use std::io::{Seek, SeekFrom};
use binread::BinReaderExt;
 
hive.seek(SeekFrom::Start(offset.0.into()))?;
let cell: Cell<KeyNodeWithMagic, ()> = hive.read_le().unwrap();
let my_node: KeyNode = {
    let knwm: KeyNodeWithMagic = cell.into();
    knwm.into()
};

For conveniance reasons, Hive already presents the method read_structure, which does basically the same.

Implementations

returns true iff the Cell is considered as being deleted

returns true iff the Cell is considered as being allocated. This is a conveniance function which simply calls is_deleted and negates the result.

returns a reference to the contained data structure

Trait Implementations

The type of arguments needed to be supplied in order to read this type, usually a tuple. Read more

Read the type from the reader

Read the type from the reader while assuming no arguments have been passed Read more

Read the type from the reader using the specified arguments

The default arguments to be used when using the read shortcut method. Override this for any type that optionally requries arguments Read more

Converts to this type from the input type.

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.