Struct BodyCursor

Source
pub struct BodyCursor<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> BodyCursor<'a>

Source

pub fn new(body: &'a mut FunctionBody, loc: CursorLocation) -> Self

Source

pub fn new_at_entry(body: &'a mut FunctionBody) -> Self

Source

pub fn set_loc(&mut self, loc: CursorLocation)

Source

pub fn loc(&self) -> CursorLocation

Source

pub fn next_loc(&self) -> CursorLocation

Source

pub fn prev_loc(&self) -> CursorLocation

Source

pub fn next_block(&self) -> Option<BasicBlockId>

Source

pub fn prev_block(&self) -> Option<BasicBlockId>

Source

pub fn proceed(&mut self)

Source

pub fn back(&mut self)

Source

pub fn body(&self) -> &FunctionBody

Source

pub fn body_mut(&mut self) -> &mut FunctionBody

Source

pub fn set_to_entry(&mut self)

Sets a cursor to an entry block.

Source

pub fn insert_inst(&mut self, inst: InstId)

Insert InstId to a location where a cursor points. If you need to store and insert Inst, use [store_and_insert_inst].

§Panics

Panics if a cursor points CursorLocation::NoWhere.

Source

pub fn store_and_insert_inst(&mut self, data: Inst) -> InstId

Source

pub fn remove_inst(&mut self)

Remove a current pointed Inst from a function body. A cursor proceeds to a next inst.

§Panics

Panics if a cursor doesn’t point CursorLocation::Inst.

Source

pub fn remove_block(&mut self)

Remove a current pointed block and contained insts from a function body. A cursor proceeds to a next block.

§Panics

Panics if a cursor doesn’t point CursorLocation::Inst.

Source

pub fn insert_block(&mut self, block: BasicBlockId)

Insert BasicBlockId to a location where a cursor points. If you need to store and insert BasicBlock, use [store_and_insert_block].

§Panics

Panics if a cursor points CursorLocation::NoWhere.

Source

pub fn store_and_insert_block(&mut self, block: BasicBlock) -> BasicBlockId

Source

pub fn map_result(&mut self, result: AssignableValue) -> Option<ValueId>

Source

pub fn expect_inst(&self) -> InstId

Returns current inst that cursor points.

§Panics

Panics if a cursor doesn’t point CursorLocation::Inst.

Source

pub fn expect_block(&self) -> BasicBlockId

Returns current block that cursor points.

§Panics

Panics if a cursor points CursorLocation::NoWhere.

Auto Trait Implementations§

§

impl<'a> Freeze for BodyCursor<'a>

§

impl<'a> RefUnwindSafe for BodyCursor<'a>

§

impl<'a> Send for BodyCursor<'a>

§

impl<'a> Sync for BodyCursor<'a>

§

impl<'a> Unpin for BodyCursor<'a>

§

impl<'a> !UnwindSafe for BodyCursor<'a>

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.