Frame

Struct Frame 

Source
pub struct Frame<T: Framer> {
    pub tag: u16,
    pub msg: T,
}

Fields§

§tag: u16§msg: T

Trait Implementations§

Source§

impl<P: Protocol> Encoder<Frame<<P as Protocol>::Request>> for ClientCodec<P>

Source§

type Error = Error

The type of encoding errors. Read more
Source§

fn encode( &mut self, item: Frame<P::Request>, dst: &mut BytesMut, ) -> Result<(), Self::Error>

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

impl<P> Encoder<Frame<<P as Protocol>::Response>> for ServerCodec<P>
where P: Protocol,

Source§

type Error = Error

The type of encoding errors. Read more
Source§

fn encode( &mut self, item: Frame<P::Response>, dst: &mut BytesMut, ) -> Result<(), Self::Error>

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

impl<T: Framer> From<(u16, T)> for Frame<T>

Source§

fn from((tag, msg): (u16, T)) -> Self

Converts to this type from the input type.
Source§

impl<T: Framer> WireFormat for Frame<T>

Source§

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.
Source§

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

Encodes self into writer.
Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Decodes Self from reader.

Auto Trait Implementations§

§

impl<T> Freeze for Frame<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Frame<T>
where T: RefUnwindSafe,

§

impl<T> Send for Frame<T>

§

impl<T> Sync for Frame<T>

§

impl<T> Unpin for Frame<T>
where T: Unpin,

§

impl<T> UnwindSafe for Frame<T>
where T: UnwindSafe,

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> ConvertWireFormat for T
where T: WireFormat,

Source§

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

Source§

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

Source§

fn as_bytes(&self) -> Vec<u8>

AsRef<u8> for the type. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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>,

Source§

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>,

Source§

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.