pub trait ListingExt {
    // Required methods
    fn add_code<S: AsRef<str> + Display>(
        &mut self,
        code: S
    ) -> Result<(), AssemblerError>;
    fn to_bytes_with_options(
        &self,
        option: EnvOptions
    ) -> Result<Vec<u8>, AssemblerError>;
    fn estimated_duration(&self) -> Result<usize, AssemblerError>;
    fn to_string(&self) -> String;
    fn to_enhanced_string(&self) -> String;
    fn inject_labels(&mut self, labels: &[(u16, &str)]);

    // Provided methods
    fn to_bytes(&self) -> Result<Vec<u8>, AssemblerError> { ... }
    fn number_of_bytes(&self) -> Result<usize, AssemblerError> { ... }
    fn save<P: AsRef<Path>>(&self, path: P) -> Result<()> { ... }
}
Expand description

Additional methods for the listings

Required Methods§

source

fn add_code<S: AsRef<str> + Display>( &mut self, code: S ) -> Result<(), AssemblerError>

source

fn to_bytes_with_options( &self, option: EnvOptions ) -> Result<Vec<u8>, AssemblerError>

source

fn estimated_duration(&self) -> Result<usize, AssemblerError>

Get the execution duration. If field duration is set, returns it. Otherwise, compute it

source

fn to_string(&self) -> String

source

fn to_enhanced_string(&self) -> String

Generate a string that contains also the bytes panic even for simple corner cases

source

fn inject_labels(&mut self, labels: &[(u16, &str)])

Modify the listing to inject labels at the given addresses

Provided Methods§

source

fn to_bytes(&self) -> Result<Vec<u8>, AssemblerError>

Assemble the listing (without context) and returns the bytes

source

fn number_of_bytes(&self) -> Result<usize, AssemblerError>

Compute the size of the listing. The listing has a size only if its tokens has a size

source

fn save<P: AsRef<Path>>(&self, path: P) -> Result<()>

Save the listing on disc in a string version

Implementors§