Skip to main content

RingConsumer

Trait RingConsumer 

Source
pub trait RingConsumer {
    // Required methods
    fn read_slot(
        &self,
        slot_idx: u32,
        out: &mut [u8],
    ) -> Result<(), ProtocolError>;
    fn slot_count(&self) -> u32;

    // Provided method
    fn try_done_count(&self) -> Result<u32, ProtocolError> { ... }
}
Expand description

Consumer half of the megakernel ring contract.

Required Methods§

Source

fn read_slot(&self, slot_idx: u32, out: &mut [u8]) -> Result<(), ProtocolError>

Copy slot slot_idx’s bytes into out. out must be exactly SLOT_BYTES long; otherwise returns ProtocolError::MisalignedByteLength.

Source

fn slot_count(&self) -> u32

Number of slots in the underlying ring.

Provided Methods§

Source

fn try_done_count(&self) -> Result<u32, ProtocolError>

Fallibly count slots currently in DONE status.

The default implementation walks the ring through Self::read_slot. Specialized consumers backed by a device/control-buffer counter may override this method to avoid host reads. Malformed slot bytes and host arithmetic overflow remain observable as ProtocolError.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§