Trait CoreExt

Source
pub trait CoreExt: Clone + Debug {
    type Reg: Register;
    type Config: Default;

    // Required methods
    fn with(config: Self::Config) -> Self;
    fn get(&self, reg: Self::Reg) -> Option<<Self::Reg as Register>::Value>;
    fn clr(&mut self, reg: Self::Reg);
    fn put(
        &mut self,
        reg: Self::Reg,
        val: Option<<Self::Reg as Register>::Value>,
    );
    fn reset(&mut self);

    // Provided method
    fn set(&mut self, reg: Self::Reg, val: <Self::Reg as Register>::Value) { ... }
}
Expand description

Extension to the AluVM core provided by an ISA.

Required Associated Types§

Source

type Reg: Register

A type of registers provided by the ISA.

Source

type Config: Default

A configuration used in initializing the core extension.

Required Methods§

Source

fn with(config: Self::Config) -> Self

Constructs the core extensions to be added to AluVM core.

Source

fn get(&self, reg: Self::Reg) -> Option<<Self::Reg as Register>::Value>

Read the value of a register.

Source

fn clr(&mut self, reg: Self::Reg)

Clear the register by setting it to None.

Source

fn put(&mut self, reg: Self::Reg, val: Option<<Self::Reg as Register>::Value>)

Put either a value or None to the register.

Source

fn reset(&mut self)

Reset the core extension by setting all the registers to None.

Provided Methods§

Source

fn set(&mut self, reg: Self::Reg, val: <Self::Reg as Register>::Value)

Set the register to the provided value.

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.

Implementors§