pub trait TokenExt:
ListingElement
+ Debug
+ Visited {
// Required methods
fn estimated_duration(&self) -> Result<usize, AssemblerError>;
fn unroll(&self, env: &Env) -> Option<Result<Vec<&Self>, AssemblerError>>;
fn disassemble_data(&self) -> Result<Listing, String>;
fn fallback_number_of_bytes(&self) -> Result<usize, String>;
// Provided methods
fn to_bytes_with_options(
&self,
option: EnvOptions,
) -> Result<Vec<u8>, AssemblerError> { ... }
fn number_of_bytes(&self) -> Result<usize, String> { ... }
fn number_of_bytes_with_context(
&self,
table: &mut SymbolsTableCaseDependent,
) -> Result<usize, String> { ... }
fn to_bytes(&self) -> Result<Vec<u8>, AssemblerError> { ... }
fn to_bytes_with_context(
&self,
table: &mut SymbolsTableCaseDependent,
) -> Result<Vec<u8>, AssemblerError> { ... }
fn is_valid(&self) -> bool { ... }
}
Expand description
Needed methods for the Token defined in cpclib_tokens
Required Methods§
fn estimated_duration(&self) -> Result<usize, AssemblerError>
Sourcefn unroll(&self, env: &Env) -> Option<Result<Vec<&Self>, AssemblerError>>
fn unroll(&self, env: &Env) -> Option<Result<Vec<&Self>, AssemblerError>>
Unroll the tokens when it represents a loop
Sourcefn disassemble_data(&self) -> Result<Listing, String>
fn disassemble_data(&self) -> Result<Listing, String>
Generate the listing of opcodes for directives that embed bytes
Sourcefn fallback_number_of_bytes(&self) -> Result<usize, String>
fn fallback_number_of_bytes(&self) -> Result<usize, String>
returns the number of bytes without assembling it
Provided Methods§
fn to_bytes_with_options( &self, option: EnvOptions, ) -> Result<Vec<u8>, AssemblerError>
Sourcefn number_of_bytes(&self) -> Result<usize, String>
fn number_of_bytes(&self) -> Result<usize, String>
Returns the number of bytes of the instructions by assembling it
Sourcefn number_of_bytes_with_context(
&self,
table: &mut SymbolsTableCaseDependent,
) -> Result<usize, String>
fn number_of_bytes_with_context( &self, table: &mut SymbolsTableCaseDependent, ) -> Result<usize, String>
Return the number of bytes of the token given the provided context
Sourcefn to_bytes(&self) -> Result<Vec<u8>, AssemblerError>
fn to_bytes(&self) -> Result<Vec<u8>, AssemblerError>
Dummy version that assemble without taking into account the context TODO find a way to not build a symbol table each time
Sourcefn to_bytes_with_context(
&self,
table: &mut SymbolsTableCaseDependent,
) -> Result<Vec<u8>, AssemblerError>
fn to_bytes_with_context( &self, table: &mut SymbolsTableCaseDependent, ) -> Result<Vec<u8>, AssemblerError>
Assemble the symbol taking into account some context, but never modify this context
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.