Trait OpAccess

Source
pub trait OpAccess {
    type Op;
    type Error: Debug + Display;

    // Required method
    fn op_access(
        &mut self,
        index: usize,
    ) -> Option<Result<Self::Op, Self::Error>>;
}
Expand description

Types that provide access to operations.

Implementations are included for &[Op], BytecodeMapped and BytecodeMappedLazy.

Required Associated Types§

Source

type Op

The operation type being accessed.

Source

type Error: Debug + Display

Any error that might occur during access.

Required Methods§

Source

fn op_access(&mut self, index: usize) -> Option<Result<Self::Op, Self::Error>>

Access the operation at the given index.

Mutable access to self is required in case operations are lazily parsed.

Any implementation should ensure the same index always returns the same operation.

Implementations on Foreign Types§

Source§

impl<'a, Op> OpAccess for &'a [Op]
where Op: Clone,

Source§

type Op = Op

Source§

type Error = Infallible

Source§

fn op_access(&mut self, index: usize) -> Option<Result<Self::Op, Self::Error>>

Implementors§

Source§

impl<'a, Op, Bytes> OpAccess for &'a BytecodeMapped<Op, Bytes>
where Op: TryFromBytes, Bytes: Deref<Target = [u8]>,

Source§

impl<Op, I> OpAccess for BytecodeMappedLazy<Op, I>
where Op: ToBytes + TryFromBytes, I: Iterator<Item = u8>,

Source§

type Op = Op

Source§

type Error = <Op as TryFromBytes>::Error