Skip to main content

Message

Trait Message 

Source
pub trait Message:
    Eq
    + PartialEq
    + Sized
    + Send
    + Sync
    + Hash
    + Copy
    + Clone
    + 'static {
    type IdType: Display + Ord + Send + Sized + Copy + Clone;

    // Required methods
    fn id(&self) -> Self::IdType;
    fn offset(&self) -> u64;
    fn encode_to(&self, dest: MutPtrByteSlice<'_>);
    fn decode_from(src: PtrByteSlice<'_>) -> Self;
    fn is_zeroes(&self) -> bool;

    // Provided methods
    fn is_open_marker(&self) -> bool { ... }
    fn encode_to_vmo(
        messages: impl IntoIterator<Item = impl Borrow<Self>>,
        block_size: usize,
    ) -> Result<Vmo, Status> { ... }
    fn decode_from_vmo(
        vmo: Vmo,
        block_size: usize,
    ) -> Result<DecodedMessageIter<Self>, Status> { ... }
}
Expand description

A fixed-size profile entry recording an access to (id, offset).

Required Associated Types§

Required Methods§

Source

fn id(&self) -> Self::IdType

Source

fn offset(&self) -> u64

Source

fn encode_to(&self, dest: MutPtrByteSlice<'_>)

Source

fn decode_from(src: PtrByteSlice<'_>) -> Self

Source

fn is_zeroes(&self) -> bool

Provided Methods§

Source

fn is_open_marker(&self) -> bool

Source

fn encode_to_vmo( messages: impl IntoIterator<Item = impl Borrow<Self>>, block_size: usize, ) -> Result<Vmo, Status>

Encodes messages into a new zx::Vmo packed into block_size-aligned blocks (typically 4 KiB) without crossing block_size boundaries. Any trailing bytes in a block that cannot fit a full message are zero-padded.

Source

fn decode_from_vmo( vmo: Vmo, block_size: usize, ) -> Result<DecodedMessageIter<Self>, Status>

Returns an iterator that lazily decodes messages from vmo one block_size-aligned block at a time. An all-zero message (Self::is_zeroes()) marks the end of the recorded stream.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§