Trait OpAccess

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

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

Types that provide access to operations.

Implementations are included for &[Op], BytecodeMapped and Arc<T>.

Required Associated Types§

Source

type Op

The operation type being accessed.

Source

type Error: Debug + Display + Send

Any error that might occur during access.

Required Methods§

Source

fn op_access(&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.

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.

Implementations on Foreign Types§

Source§

impl<Op> OpAccess for &[Op]
where Op: Clone + Send + Sync,

Source§

type Op = Op

Source§

type Error = Infallible

Source§

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

Source§

impl<T> OpAccess for Arc<T>
where T: OpAccess,

Source§

type Op = <T as OpAccess>::Op

Source§

type Error = <T as OpAccess>::Error

Source§

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

Implementors§

Source§

impl<Op, Bytes> OpAccess for &BytecodeMapped<Op, Bytes>
where Op: TryFromBytes + Send + Sync, Bytes: Deref<Target = [u8]> + Send + Sync,