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§
Sourcefn read_slot(&self, slot_idx: u32, out: &mut [u8]) -> Result<(), ProtocolError>
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.
Sourcefn slot_count(&self) -> u32
fn slot_count(&self) -> u32
Number of slots in the underlying ring.
Provided Methods§
Sourcefn try_done_count(&self) -> Result<u32, ProtocolError>
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".