Struct object::build::Table

source ·
pub struct Table<T>(/* private fields */);
Expand description

A table of items.

Each item has a unique identifier. Items can be deleted without changing the identifiers of other items.

Implementations§

source§

impl<T: Item> Table<T>

source

pub fn is_empty(&self) -> bool

Return True if there are no non-deleted items.

source

pub fn count(&self) -> usize

Number of non-deleted items.

source

pub fn get(&self, id: T::Id) -> &T

Return a reference to an item.

source

pub fn get_mut(&mut self, id: T::Id) -> &mut T

Return a mutable reference to a segment.

source

pub fn iter(&self) -> TableIter<'_, T>

Return an iterator for the segments.

source

pub fn iter_mut(&mut self) -> TableIterMut<'_, T>

Return a mutable iterator for the segments.

source§

impl<'data> Table<Segment<'data>>

source

pub fn add(&mut self) -> &mut Segment<'data>

Add a new segment to the table.

source

pub fn find_load_segment_from_offset( &self, offset: u64 ) -> Option<&Segment<'data>>

Find a PT_LOAD segment containing the given offset.

source

pub fn add_load_segment( &mut self, flags: u32, align: u64 ) -> &mut Segment<'data>

Add a new PT_LOAD segment to the table.

The file offset and address will be derived from the current maximum for any segment. The address will be chosen so that p_paddr % align == p_offset % align. You may wish to use Builder::load_align for the alignment.

source

pub fn copy(&mut self, id: SegmentId) -> &mut Segment<'data>

Add a copy of a segment to the table.

This will copy the segment type, flags and alignment.

Additionally, if the segment type is PT_LOAD, then the file offset and address will be set as in add_load_segment.

source§

impl<'data> Table<Section<'data>>

source

pub fn add(&mut self) -> &mut Section<'data>

Add a new section to the table.

source

pub fn copy(&mut self, id: SectionId) -> &mut Section<'data>

Add a copy of a section to the table.

This will set the file offset of the copy to zero. Segment::append_section can be used to assign a valid file offset and a new address.

source§

impl<'data, const DYNAMIC: bool> Table<Symbol<'data, DYNAMIC>>

source

pub fn count_defined(&self) -> usize

Number of defined symbols.

source

pub fn add(&mut self) -> &mut Symbol<'data, DYNAMIC>

Add a new symbol to the table.

source§

impl<'data> Table<VersionFile<'data>>

source

pub fn add(&mut self, name: ByteString<'data>) -> VersionFileId

Add a new filename to the table.

source§

impl<'data> Table<Version<'data>>

source

pub fn add(&mut self, data: VersionData<'data>) -> VersionId

Add a version.

Trait Implementations§

source§

impl<T: Debug> Debug for Table<T>

source§

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

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

impl<'a, T: Item> IntoIterator for &'a Table<T>

§

type Item = &'a T

The type of the elements being iterated over.
§

type IntoIter = TableIter<'a, T>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> TableIter<'a, T>

Creates an iterator from a value. Read more
source§

impl<'a, T: Item> IntoIterator for &'a mut Table<T>

§

type Item = &'a mut T

The type of the elements being iterated over.
§

type IntoIter = TableIterMut<'a, T>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> TableIterMut<'a, T>

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Table<T>

§

impl<T> RefUnwindSafe for Table<T>
where T: RefUnwindSafe,

§

impl<T> Send for Table<T>
where T: Send,

§

impl<T> Sync for Table<T>
where T: Sync,

§

impl<T> Unpin for Table<T>
where T: Unpin,

§

impl<T> UnwindSafe for Table<T>
where T: UnwindSafe,

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>,

§

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>,

§

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.