pub struct State<'a> {
pub stmts: &'a mut Vec<Stmt>,
pub target: &'a str,
pub file_data: &'a mut DynasmData,
}
Expand description
This struct contains all non-parsing state that dynasm! requires while parsing and compiling
Fields§
§stmts: &'a mut Vec<Stmt>
§target: &'a str
§file_data: &'a mut DynasmData
Trait Implementations§
Source§impl AssembleX64 for State<'_>
impl AssembleX64 for State<'_>
Source§fn compile_instruction(
&mut self,
arch: &Archx64,
instruction: InstructionX64,
) -> Result<(), Error>
fn compile_instruction( &mut self, arch: &Archx64, instruction: InstructionX64, ) -> Result<(), Error>
Turn an expression into binary format.
May error when dynamic data is present at bad locations such as memory address scaling.
Source§fn build_instruction(
&mut self,
_: &Archx64,
_: InstructionX64,
) -> Result<(), Error>where
Self: BasicExprBuilder,
fn build_instruction(
&mut self,
_: &Archx64,
_: InstructionX64,
) -> Result<(), Error>where
Self: BasicExprBuilder,
Create an instruction composed from dynamic data.
Only available when the type is also capable of building new composite expressions.
Source§impl AssembleX86 for State<'_>
impl AssembleX86 for State<'_>
Source§fn compile_instruction(
&mut self,
arch: &Archx86,
instruction: InstructionX86,
) -> Result<(), Error>
fn compile_instruction( &mut self, arch: &Archx86, instruction: InstructionX86, ) -> Result<(), Error>
Turn an expression into binary format.
May error when dynamic data is present at bad locations such as memory address scaling.
Source§fn build_instruction(
&mut self,
_: &Archx86,
_: InstructionX86,
) -> Result<(), Error>where
Self: BasicExprBuilder,
fn build_instruction(
&mut self,
_: &Archx86,
_: InstructionX86,
) -> Result<(), Error>where
Self: BasicExprBuilder,
Create an instruction composed from dynamic data.
Only available when the type is also capable of building new composite expressions.
Source§impl BasicExprBuilder for State<'_>
A simple implementation of a BasicExprBuilder
.
impl BasicExprBuilder for State<'_>
A simple implementation of a BasicExprBuilder
.
It can not combine any expressions, pushes statements into a Vec
and emits errors onto
standard error directly.
Source§fn emit_error_at(&mut self, _: ErrorSpan, args: Arguments<'_>)
fn emit_error_at(&mut self, _: ErrorSpan, args: Arguments<'_>)
Emits the error message on stderr
.
Auto Trait Implementations§
impl<'a> Freeze for State<'a>
impl<'a> !RefUnwindSafe for State<'a>
impl<'a> Send for State<'a>
impl<'a> !Sync for State<'a>
impl<'a> Unpin for State<'a>
impl<'a> !UnwindSafe for State<'a>
Blanket Implementations§
Source§impl<T> BasicExprBuilderExt for Twhere
T: BasicExprBuilder + ?Sized,
impl<T> BasicExprBuilderExt for Twhere
T: BasicExprBuilder + ?Sized,
fn bit_or_else_err(&mut self, a: Expr, b: Value) -> Result<Expr, Error>
fn bit_and_else_err(&mut self, a: Expr, b: Value) -> Result<Expr, Error>
fn bit_xor_else_err(&mut self, a: Expr, b: Value) -> Result<Expr, Error>
fn neg_else_err(&mut self, a: Expr) -> Result<Expr, Error>
fn add_else_err(&mut self, a: Expr, b: Value) -> Result<Expr, Error>
fn mul_else_err(&mut self, a: Expr, b: Value) -> Result<Expr, Error>
fn add_many(&mut self, iter: impl IntoIterator<Item = Expr>) -> Option<Value>
fn add_many_else_err( &mut self, iter: impl IntoIterator<Item = Expr>, ) -> Result<Value, Error>
Source§fn mask_shift_or(
&mut self,
reg: Value,
val: Expr,
mask: u64,
shift: i8,
) -> Option<Expr>
fn mask_shift_or( &mut self, reg: Value, val: Expr, mask: u64, shift: i8, ) -> Option<Expr>
reg | ((val & mask) << shift)
val
is not a Value since then the lib could already constant fold until |
.Source§fn mask_shift_or_else_err(
&mut self,
reg: Value,
val: Expr,
mask: u64,
shift: i8,
) -> Result<Expr, Error>
fn mask_shift_or_else_err( &mut self, reg: Value, val: Expr, mask: u64, shift: i8, ) -> Result<Expr, Error>
reg | ((val & mask) << shift)
Source§fn mask_shift_inverted_and(
&mut self,
reg: Value,
val: Expr,
mask: u64,
shift: i8,
) -> Option<Expr>
fn mask_shift_inverted_and( &mut self, reg: Value, val: Expr, mask: u64, shift: i8, ) -> Option<Expr>
reg & !((val & mask) << shift)
val
is not a Value since then the lib could already constant fold until |
.Source§fn mask_shift_inverted_and_else_err(
&mut self,
reg: Value,
val: Expr,
mask: u64,
shift: i8,
) -> Result<Expr, Error>
fn mask_shift_inverted_and_else_err( &mut self, reg: Value, val: Expr, mask: u64, shift: i8, ) -> Result<Expr, Error>
reg | ((val & mask) << shift)
fn log2_else_err(&mut self, a: Expr) -> Result<Expr, Error>
fn dynscale(&mut self, _: Expr, _: Value) -> Result<(Expr, Expr), Error>
fn mask_shift_else_err( &mut self, val: Expr, mask: u64, shift: i8, ) -> Result<Expr, Error>
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