Enum cuprate_levin::message::LevinMessage

source ·
pub enum LevinMessage<T: LevinBody> {
    Body(T),
    Bucket(Bucket<T::Command>),
    Dummy(usize),
}
Expand description

A levin message that can be sent to a peer.

Variants§

§

Body(T)

A message body.

A levin header will be added to this message before it is sent to the peer.

§

Bucket(Bucket<T::Command>)

A full levin bucket.

This bucket will be sent to the peer directly with no extra information.

This should only be used to send fragmented messages: make_fragmented_messages

§

Dummy(usize)

A dummy message.

A dummy message which the peer will ignore. The dummy message will be the exact size (in bytes) of the given usize on the wire.

Trait Implementations§

source§

impl<T: LevinBody> Encoder<LevinMessage<T>> for LevinMessageCodec<T>

§

type Error = BucketError

The type of encoding errors. Read more
source§

fn encode( &mut self, item: LevinMessage<T>, dst: &mut BytesMut, ) -> Result<(), Self::Error>

Encodes a frame into the buffer provided. Read more
source§

impl<T: LevinBody> From<Bucket<<T as LevinBody>::Command>> for LevinMessage<T>

source§

fn from(value: Bucket<T::Command>) -> Self

Converts to this type from the input type.
source§

impl<T: LevinBody> From<Dummy> for LevinMessage<T>

source§

fn from(value: Dummy) -> Self

Converts to this type from the input type.
source§

impl<T: LevinBody> From<T> for LevinMessage<T>

source§

fn from(value: T) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T> !Freeze for LevinMessage<T>

§

impl<T> RefUnwindSafe for LevinMessage<T>

§

impl<T> Send for LevinMessage<T>
where T: Send, <T as LevinBody>::Command: Send,

§

impl<T> Sync for LevinMessage<T>
where T: Sync, <T as LevinBody>::Command: Sync,

§

impl<T> Unpin for LevinMessage<T>
where T: Unpin, <T as LevinBody>::Command: Unpin,

§

impl<T> UnwindSafe for LevinMessage<T>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.