[][src]Trait turingdb_helpers::TuringPacket

pub trait TuringPacket<'tp> {
#[must_use]    fn into_packet<'async_trait, T>(
        value: T
    ) -> Pin<Box<dyn Future<Output = &'tp [u8]> + Send + 'async_trait>>
    where
        T: 'async_trait
; }

Ensures that a data structure is converted to bytes before it is sent over the wire

Required methods

#[must_use]fn into_packet<'async_trait, T>(
    value: T
) -> Pin<Box<dyn Future<Output = &'tp [u8]> + Send + 'async_trait>> where
    T: 'async_trait, 

Converts a data structure into bytes in order to be sent over the wire

Usage

use crate::TuringPacket;

struct Foo;

impl TuringPacket for Foo {
    async fn into_packet(value: T) -> &'tp [u8] {
        value.as_bytes()
    }
}
Loading content...

Implementors

Loading content...