pub struct CodeImage { /* private fields */ }Expand description
Immutable native x86_64 bytes and translation metadata.
Implementations§
Source§impl CodeImage
impl CodeImage
Sourcepub fn bytes(&self) -> &[u8] ⓘ
pub fn bytes(&self) -> &[u8] ⓘ
Returns immutable executable bytes. The first byte is the function entry and the bytes are suitable for a W^X publisher to copy.
Sourcepub const fn entry_offset(&self) -> u32
pub const fn entry_offset(&self) -> u32
Returns the native entry offset.
Sourcepub fn instruction_boundaries(&self) -> &[u32]
pub fn instruction_boundaries(&self) -> &[u32]
Returns source boundaries including the terminal code length.
Sourcepub fn instruction_map(&self) -> &[InstructionMap]
pub fn instruction_map(&self) -> &[InstructionMap]
Returns source-to-native instruction mappings.
Sourcepub fn relocations(&self) -> &[Relocation]
pub fn relocations(&self) -> &[Relocation]
Returns relocations. Direct images always return an empty slice.
Sourcepub const fn profile(&self) -> InputProfile
pub const fn profile(&self) -> InputProfile
Returns the input ABI profile used by native load emission.
Sourcepub fn image_size(&self) -> usize
pub fn image_size(&self) -> usize
Returns the exact native byte length.
Sourcepub fn page_aligned_size(&self, page_size: usize) -> Option<usize>
pub fn page_aligned_size(&self, page_size: usize) -> Option<usize>
Returns the page-rounded size required by a publisher.
Sourcepub fn into_parts(
self,
) -> (Vec<u8>, Vec<Relocation>, u32, Vec<u32>, Vec<InstructionMap>)
pub fn into_parts( self, ) -> (Vec<u8>, Vec<Relocation>, u32, Vec<u32>, Vec<InstructionMap>)
Returns owned bytes and publisher metadata.
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Returns owned native bytes.
Sourcepub fn validate(&self) -> Result<(), ImageValidationError>
pub fn validate(&self) -> Result<(), ImageValidationError>
Independently validates native code, source map, branches and relocations.
Trait Implementations§
Auto Trait Implementations§
impl Forget for CodeImage
impl Freeze for CodeImage
impl RefUnwindSafe for CodeImage
impl Send for CodeImage
impl Sync for CodeImage
impl Unpin for CodeImage
impl UnsafeUnpin for CodeImage
impl UnwindSafe for CodeImage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more