Struct commitlog::message::MessageBuf[][src]

pub struct MessageBuf { /* fields omitted */ }

Mutable message buffer.

The buffer will handle the serialization of the message into the proper format expected by the CommitLog.

Implementations

impl MessageBuf[src]

pub fn from_bytes(bytes: Vec<u8>) -> Result<MessageBuf, MessageError>[src]

Creates a message buffer from a previously serialized vector of bytes. Integrity checking is performed on the vector to ensure that it was properly serialized.

pub fn clear(&mut self)[src]

Clears the message buffer.

pub unsafe fn unsafe_clear(&mut self)[src]

Clears the message buffer without dropping the contents.

pub fn into_bytes(self) -> Vec<u8>[src]

Moves the underlying serialized bytes into a vector.

pub fn push<B: AsRef<[u8]>>(
    &mut self,
    payload: B
) -> Result<(), MessageSerializationError>
[src]

Adds a new message to the buffer.

pub fn push_with_metadata<M: AsRef<[u8]>, B: AsRef<[u8]>>(
    &mut self,
    metadata: M,
    payload: B
) -> Result<(), MessageSerializationError>
[src]

Adds a new message with metadata.

pub fn read<R: Read>(&mut self, reader: &mut R) -> Result<(), MessageError>[src]

Reads a single message. The reader is expected to have a full message serialized.

Trait Implementations

impl Default for MessageBuf[src]

impl<R: AsRef<[u8]>> FromIterator<R> for MessageBuf[src]

impl MessageSet for MessageBuf[src]

fn bytes(&self) -> &[u8][src]

Bytes that make up the serialized message set.

fn len(&self) -> usize[src]

Number of messages in the message set.

impl MessageSetMut for MessageBuf[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.