hao 0.0.19

Read, edit, create and write .net assemblies
Documentation
//! PE structures the metadata is found through.

use crate::{
    error::Result,
    io::{DataReader, ReadData},
};

/// An RVA and size locating a region of the PE image, such as the metadata in
/// the CLI header.
#[derive(Default, Clone, Debug, PartialEq, Eq)]
pub struct ImageDataDirectory {
    /// RVA of the region; 0 if absent.
    pub virtual_address: u32,
    /// Size of the region in bytes.
    pub data_size: u32,
}

impl ImageDataDirectory {
    /// Reads the 8-byte directory: RVA, then size.
    pub fn from_reader(r: &mut DataReader) -> Result<Self> {
        Ok(Self {
            virtual_address: r.read()?,
            data_size: r.read()?,
        })
    }
}