pub struct BytecodeSegments {
segments: Vec<BytecodeSegment>,
}Expand description
Collection of bytecode segments with helper methods
Fields§
§segments: Vec<BytecodeSegment>Implementations§
Source§impl BytecodeSegments
impl BytecodeSegments
Sourcepub fn push(&mut self, segment: BytecodeSegment)
pub fn push(&mut self, segment: BytecodeSegment)
Push a bytecode segment
Sourcepub fn push_with_offset(&mut self, offset: usize, bytes: Bytes)
pub fn push_with_offset(&mut self, offset: usize, bytes: Bytes)
Push a bytecode segment with an offset (without scope information)
Sourcepub fn extend(&mut self, other: BytecodeSegments)
pub fn extend(&mut self, other: BytecodeSegments)
Extend with another collection
Sourcepub fn iter(&self) -> impl Iterator<Item = &BytecodeSegment>
pub fn iter(&self) -> impl Iterator<Item = &BytecodeSegment>
Get an iterator over the segments
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut BytecodeSegment>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut BytecodeSegment>
Get a mutable iterator over the segments
Sourcepub fn calculate_offsets(&self) -> Vec<usize>
pub fn calculate_offsets(&self) -> Vec<usize>
Calculate the cumulative byte offsets for each segment Returns a vector where each element is the byte offset of the corresponding segment
Sourcepub fn total_byte_size(&self) -> usize
pub fn total_byte_size(&self) -> usize
Calculate the total byte size of all segments
Sourcepub fn find_jump_placeholders(&self) -> Vec<(usize, &JumpPlaceholderData)>
pub fn find_jump_placeholders(&self) -> Vec<(usize, &JumpPlaceholderData)>
Find all jump placeholders with their byte offsets Returns a vector of (offset, jump_data) tuples
Sourcepub fn resolve_jumps(
&mut self,
jump_table: &JumpTable,
label_indices: &LabelIndices,
) -> Result<Vec<Jump>, LabelError>
pub fn resolve_jumps( &mut self, jump_table: &JumpTable, label_indices: &LabelIndices, ) -> Result<Vec<Jump>, LabelError>
Resolve all jump placeholders using the provided jump table and label indices Returns a vector of unmatched jumps that couldn’t be resolved
Sourcepub fn measure_circular_codesize(
&mut self,
macro_name: &str,
start: usize,
end: usize,
)
pub fn measure_circular_codesize( &mut self, macro_name: &str, start: usize, end: usize, )
Marks [start, end) as the code measured by the circular codesize placeholders of
macro_name that do not measure an invocation yet.
Called when an invocation of macro_name is fully generated, so a placeholder measures the
innermost invocation of the macro it names.
Sourcepub fn resolve_circular_codesize(&mut self) -> usize
pub fn resolve_circular_codesize(&mut self) -> usize
Fills all circular codesize placeholders with the current size of the code they measure.
Returns the number of bytes the placeholders grew by.
Trait Implementations§
Source§impl Clone for BytecodeSegments
impl Clone for BytecodeSegments
Source§impl Debug for BytecodeSegments
impl Debug for BytecodeSegments
Source§impl Default for BytecodeSegments
impl Default for BytecodeSegments
impl Eq for BytecodeSegments
Source§impl IntoIterator for BytecodeSegments
impl IntoIterator for BytecodeSegments
Source§impl<'a> IntoIterator for &'a BytecodeSegments
impl<'a> IntoIterator for &'a BytecodeSegments
Source§impl Ord for BytecodeSegments
impl Ord for BytecodeSegments
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for BytecodeSegments
impl PartialEq for BytecodeSegments
Source§impl PartialOrd for BytecodeSegments
impl PartialOrd for BytecodeSegments
impl StructuralPartialEq for BytecodeSegments
Auto Trait Implementations§
impl Freeze for BytecodeSegments
impl RefUnwindSafe for BytecodeSegments
impl Send for BytecodeSegments
impl Sync for BytecodeSegments
impl Unpin for BytecodeSegments
impl UnsafeUnpin for BytecodeSegments
impl UnwindSafe for BytecodeSegments
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<S, T> Upcast<T> for S
impl<S, T> Upcast<T> for S
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes