pub struct Bitcode { /* private fields */ }
Expand description
Memory conserving representation of IL code.
Implementations§
Source§impl Bitcode
impl Bitcode
Sourcepub fn append<I: IntoIterator<Item = Statement> + Sized>(
&mut self,
i: I,
) -> Result<Range<usize>>
pub fn append<I: IntoIterator<Item = Statement> + Sized>( &mut self, i: I, ) -> Result<Range<usize>>
Appends statements in i
to the bitcode vector, returing the new byte range.
Sourcepub fn with_capacity(cap: usize) -> Bitcode
pub fn with_capacity(cap: usize) -> Bitcode
Creates an empty Bitcode vector with initial capacity cap
.
Sourcepub fn rewrite<F: FnMut(&mut Statement, &mut Names, &mut Strings, &mut Segments) -> Result<RewriteControl> + Sized>(
&mut self,
range: Range<usize>,
names: &mut Names,
strings: &mut Strings,
segments: &mut Segments,
func: F,
) -> Result<Range<usize>>
pub fn rewrite<F: FnMut(&mut Statement, &mut Names, &mut Strings, &mut Segments) -> Result<RewriteControl> + Sized>( &mut self, range: Range<usize>, names: &mut Names, strings: &mut Strings, segments: &mut Segments, func: F, ) -> Result<Range<usize>>
Maps function func
over all statements in range
, and writing them back into the vector.
Sourcepub fn insert(
&mut self,
pos: usize,
stmts: Vec<Statement>,
) -> Result<Range<usize>>
pub fn insert( &mut self, pos: usize, stmts: Vec<Statement>, ) -> Result<Range<usize>>
Serializes the statements in stmts
and writes the bytes into position pos
. Returns the
inserted byte range.
Sourcepub fn iter<'a>(&'a self) -> BitcodeIter<'a> ⓘ
pub fn iter<'a>(&'a self) -> BitcodeIter<'a> ⓘ
Iterator over all statements.
Sourcepub fn iter_range<'a>(&'a self, rgn: Range<usize>) -> BitcodeIter<'a> ⓘ
pub fn iter_range<'a>(&'a self, rgn: Range<usize>) -> BitcodeIter<'a> ⓘ
Iterator over all statements inside byte range rgn
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Bitcode
impl RefUnwindSafe for Bitcode
impl Send for Bitcode
impl Sync for Bitcode
impl Unpin for Bitcode
impl UnwindSafe for Bitcode
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