Struct Structure

Source
pub struct Structure { /* private fields */ }

Implementations§

Source§

impl Structure

Source

pub fn builder() -> StructureBuilder

Source

pub fn width(&self) -> u64

Source

pub fn structure_type(&self) -> StructureType

Source

pub fn members_at_offset( &self, container: &TypeContainer, offset: u64, ) -> Vec<StructureMember>

Retrieve the members that are accessible at a given offset.

The reason for this being plural is that members may overlap and the offset is in bytes where a bitfield may contain multiple members at the given byte.

Unions are also represented as structures and will cause this function to return all members that can reach that offset.

We must pass a TypeContainer here so that we can resolve base structure members, as they are treated as members through this function. Typically, you get the TypeContainer through the binary view with BinaryViewExt::type_container.

Source

pub fn members(&self) -> Vec<StructureMember>

Return the list of non-inherited structure members.

If you want to get all members, including ones inherited from base structures, use Structure::members_including_inherited instead.

Source

pub fn members_including_inherited( &self, container: &TypeContainer, ) -> Vec<InheritedStructureMember>

Returns the list of all structure members, including inherited ones.

Because we must traverse through base structures, we have to provide the TypeContainer; in most cases it is ok to provide the binary views container via BinaryViewExt::type_container.

Source

pub fn base_structures(&self) -> Vec<BaseStructure>

Retrieve the list of base structures for the structure. These base structures are what give a structure inherited members.

Source

pub fn is_packed(&self) -> bool

Whether the structure is packed or not.

Source

pub fn alignment(&self) -> usize

Trait Implementations§

Source§

impl Debug for Structure

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&Structure> for StructureBuilder

Source§

fn from(structure: &Structure) -> StructureBuilder

Converts to this type from the input type.
Source§

impl Hash for Structure

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Structure

Source§

fn eq(&self, other: &Structure) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ToOwned for Structure

Source§

type Owned = Ref<Structure>

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl Eq for Structure

Source§

impl StructuralPartialEq for Structure

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.