pub struct InstructionInserter<'a, 'eng> { /* private fields */ }
Expand description
Provide a context for inserting new Instruction
s to a Block
.
Implementations§
Source§impl<'a, 'eng> InstructionInserter<'a, 'eng>
impl<'a, 'eng> InstructionInserter<'a, 'eng>
Sourcepub fn new(
context: &'a mut Context<'eng>,
block: Block,
position: InsertionPosition,
) -> InstructionInserter<'a, 'eng>
pub fn new( context: &'a mut Context<'eng>, block: Block, position: InsertionPosition, ) -> InstructionInserter<'a, 'eng>
Return a new InstructionInserter
context for block
.
pub fn insert_slice(&mut self, slice: &[Value])
pub fn insert(&mut self, inst: Value)
Sourcepub fn asm_block(
self,
args: Vec<AsmArg>,
body: Vec<AsmInstruction>,
return_type: Type,
return_name: Option<Ident>,
) -> Value
pub fn asm_block( self, args: Vec<AsmArg>, body: Vec<AsmInstruction>, return_type: Type, return_name: Option<Ident>, ) -> Value
Append a new InstOp::AsmBlock from args
and a body
.
pub fn asm_block_from_asm(self, asm: AsmBlock, args: Vec<AsmArg>) -> Value
pub fn bitcast(self, value: Value, ty: Type) -> Value
pub fn unary_op(self, op: UnaryOpKind, arg: Value) -> Value
pub fn wide_unary_op(self, op: UnaryOpKind, arg: Value, result: Value) -> Value
pub fn wide_binary_op( self, op: BinaryOpKind, arg1: Value, arg2: Value, result: Value, ) -> Value
pub fn wide_modular_op( self, op: BinaryOpKind, result: Value, arg1: Value, arg2: Value, arg3: Value, ) -> Value
pub fn wide_cmp_op(self, op: Predicate, arg1: Value, arg2: Value) -> Value
pub fn binary_op(self, op: BinaryOpKind, arg1: Value, arg2: Value) -> Value
pub fn branch(self, to_block: Block, dest_params: Vec<Value>) -> Value
pub fn call(self, function: Function, args: &[Value]) -> Value
pub fn cast_ptr(self, val: Value, ty: Type) -> Value
pub fn cmp(self, pred: Predicate, lhs_value: Value, rhs_value: Value) -> Value
pub fn conditional_branch( self, cond_value: Value, true_block: Block, false_block: Block, true_dest_params: Vec<Value>, false_dest_params: Vec<Value>, ) -> Value
pub fn contract_call( self, return_type: Type, name: Option<String>, params: Value, coins: Value, asset_id: Value, gas: Value, ) -> Value
pub fn gtf(self, index: Value, tx_field_id: u64) -> Value
pub fn get_elem_ptr( self, base: Value, elem_ty: Type, indices: Vec<Value>, ) -> Value
pub fn get_elem_ptr_with_idx( self, base: Value, elem_ty: Type, index: u64, ) -> Value
pub fn get_elem_ptr_with_idcs( self, base: Value, elem_ty: Type, indices: &[u64], ) -> Value
pub fn get_local(self, local_var: LocalVar) -> Value
pub fn get_config(self, module: Module, name: String) -> Value
pub fn int_to_ptr(self, value: Value, ty: Type) -> Value
pub fn load(self, src_val: Value) -> Value
pub fn log(self, log_val: Value, log_ty: Type, log_id: Value) -> Value
pub fn mem_copy_bytes( self, dst_val_ptr: Value, src_val_ptr: Value, byte_len: u64, ) -> Value
pub fn mem_copy_val(self, dst_val_ptr: Value, src_val_ptr: Value) -> Value
pub fn nop(self) -> Value
pub fn ptr_to_int(self, value: Value, ty: Type) -> Value
pub fn read_register(self, reg: Register) -> Value
pub fn ret(self, value: Value, ty: Type) -> Value
pub fn retd(self, ptr: Value, len: Value) -> Value
pub fn revert(self, value: Value) -> Value
pub fn jmp_mem(self) -> Value
pub fn smo( self, recipient: Value, message: Value, message_size: Value, coins: Value, ) -> Value
pub fn state_clear(self, key: Value, number_of_slots: Value) -> Value
pub fn state_load_quad_word( self, load_val: Value, key: Value, number_of_slots: Value, ) -> Value
pub fn state_load_word(self, key: Value) -> Value
pub fn state_store_quad_word( self, stored_val: Value, key: Value, number_of_slots: Value, ) -> Value
pub fn state_store_word(self, stored_val: Value, key: Value) -> Value
pub fn store(self, dst_val_ptr: Value, stored_val: Value) -> Value
Auto Trait Implementations§
impl<'a, 'eng> Freeze for InstructionInserter<'a, 'eng>
impl<'a, 'eng> !RefUnwindSafe for InstructionInserter<'a, 'eng>
impl<'a, 'eng> Send for InstructionInserter<'a, 'eng>
impl<'a, 'eng> !Sync for InstructionInserter<'a, 'eng>
impl<'a, 'eng> Unpin for InstructionInserter<'a, 'eng>
impl<'a, 'eng> !UnwindSafe for InstructionInserter<'a, 'eng>
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.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>
Converts
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>
Converts
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<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> StorageAsMut for T
impl<T> StorageAsMut for T
fn storage<Type>(&mut self) -> StorageMut<'_, Self, Type>where
Type: Mappable,
fn storage_as_mut<Type>(&mut self) -> StorageMut<'_, Self, Type>where
Type: Mappable,
Source§impl<T> StorageAsRef for T
impl<T> StorageAsRef for T
fn storage<Type>(&self) -> StorageRef<'_, Self, Type>where
Type: Mappable,
fn storage_as_ref<Type>(&self) -> StorageRef<'_, Self, Type>where
Type: Mappable,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.