[−][src]Enum imperative_rs::DecodeError
This type is returned by fn InstructionSet::decode(...)
in case no instruction could be
decoded.
Variants
This variant is emitted if the slice contains no known opcode.
Is emitted if the slice ended before a complete opcode could be found. Extending the end of the slice could lead to successful decoding.
Is emitted if the opcode encodes a variable that is too big for the corresponding variable.
An example would be if the opcode contains a 9 bit variable that is put into a u8
during
decoding.
use imperative::{InstructionSet, DecodeError}; #[derive(InstructionSet)] enum Is { #[opcode = "0b0000000v_vvvvvvvv"] A{v:u8}, } fn main () { let mem = [0b00000001, 0b11111111]; let instr = Is::decode(&mem); assert_eq!(DecodeError::Overflow, instr); //trying to cast 256 into an u8 }
Trait Implementations
impl Debug for DecodeError
[src]
impl PartialEq<DecodeError> for DecodeError
[src]
fn eq(&self, other: &DecodeError) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<DecodeError> for DecodeError
[src]
fn partial_cmp(&self, other: &DecodeError) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralPartialEq for DecodeError
[src]
Auto Trait Implementations
impl RefUnwindSafe for DecodeError
impl Send for DecodeError
impl Sync for DecodeError
impl Unpin for DecodeError
impl UnwindSafe for DecodeError
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,