Skip to main content

Reg

Trait Reg 

Source
pub trait Reg:
    Sized
    + Copy
    + Eq
    + Ord
    + Hash
    + Into<AnyReg>
    + Debug
    + Display {
    const RANGE: Range<u8>;

    // Required methods
    unsafe fn new_unchecked(index: u8) -> Self;
    fn to_u8(self) -> u8;

    // Provided methods
    fn new(index: u8) -> Option<Self> { ... }
    fn index(self) -> usize { ... }
}
Expand description

Trait for common register operations.

Required Associated Constants§

Source

const RANGE: Range<u8>

Range of valid register indices.

Required Methods§

Source

unsafe fn new_unchecked(index: u8) -> Self

Convert a register index to a register, without bounds checking.

Source

fn to_u8(self) -> u8

Convert a register to its index.

Provided Methods§

Source

fn new(index: u8) -> Option<Self>

Convert a register index to a register, with bounds checking.

Source

fn index(self) -> usize

Convert a register to its index.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§