Trait Sendable

Source
pub trait Sendable: Sized + Debug {
    // Required methods
    fn send(&self) -> Vec<u8> ;
    fn recv(data: &mut dyn Read) -> Result<Self>;

    // Provided methods
    fn header(&self) -> PacketHeader<Self> { ... }
    fn size(&self) -> u32 { ... }
}
Expand description

A trait for types that can be sent over the network.

Sendable has the Debug bound because it is internally useful, and can be helpful for debugging.

Required Methods§

Source

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

Converts the type to a Vec that can be sent over the network.

Source

fn recv(data: &mut dyn Read) -> Result<Self>

Converts an incoming stream of bytes to the type.

Provided Methods§

Source

fn header(&self) -> PacketHeader<Self>

Returns the header of the packet.

Source

fn size(&self) -> u32

Returns the size of the type.

This does not return the size of the type in memory, but the size of the type when sent over the network.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Sendable for bool

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl Sendable for f32

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl Sendable for f64

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl Sendable for i8

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl Sendable for i16

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl Sendable for i32

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl Sendable for i64

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl Sendable for i128

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl Sendable for u8

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl Sendable for u16

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl Sendable for u32

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl Sendable for u64

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl Sendable for u128

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl Sendable for ()

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(_reader: &mut dyn Read) -> Result<Self>

Source§

impl Sendable for String

Source§

fn header(&self) -> PacketHeader<Self>

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl<A: Sendable + Debug> Sendable for (A,)

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(reader: &mut dyn Read) -> Result<Self>

Source§

impl<A: Sendable + Debug, B: Sendable + Debug> Sendable for (A, B)

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(reader: &mut dyn Read) -> Result<Self>

Source§

impl<A: Sendable + Debug, B: Sendable + Debug, C: Sendable + Debug> Sendable for (A, B, C)

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(reader: &mut dyn Read) -> Result<Self>

Source§

impl<A: Sendable + Debug, B: Sendable + Debug, C: Sendable + Debug, D: Sendable + Debug> Sendable for (A, B, C, D)

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(reader: &mut dyn Read) -> Result<Self>

Source§

impl<A: Sendable + Debug, B: Sendable + Debug, C: Sendable + Debug, D: Sendable + Debug, E: Sendable + Debug> Sendable for (A, B, C, D, E)

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(reader: &mut dyn Read) -> Result<Self>

Source§

impl<A: Sendable + Debug, B: Sendable + Debug, C: Sendable + Debug, D: Sendable + Debug, E: Sendable + Debug, F: Sendable + Debug> Sendable for (A, B, C, D, E, F)

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(reader: &mut dyn Read) -> Result<Self>

Source§

impl<A: Sendable + Debug, B: Sendable + Debug, C: Sendable + Debug, D: Sendable + Debug, E: Sendable + Debug, F: Sendable + Debug, G: Sendable + Debug> Sendable for (A, B, C, D, E, F, G)

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(reader: &mut dyn Read) -> Result<Self>

Source§

impl<A: Sendable + Debug, B: Sendable + Debug, C: Sendable + Debug, D: Sendable + Debug, E: Sendable + Debug, F: Sendable + Debug, G: Sendable + Debug, H: Sendable + Debug> Sendable for (A, B, C, D, E, F, G, H)

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(reader: &mut dyn Read) -> Result<Self>

Source§

impl<A: Sendable + Debug, B: Sendable + Debug, C: Sendable + Debug, D: Sendable + Debug, E: Sendable + Debug, F: Sendable + Debug, G: Sendable + Debug, H: Sendable + Debug, I: Sendable + Debug> Sendable for (A, B, C, D, E, F, G, H, I)

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(reader: &mut dyn Read) -> Result<Self>

Source§

impl<A: Sendable + Debug, B: Sendable + Debug, C: Sendable + Debug, D: Sendable + Debug, E: Sendable + Debug, F: Sendable + Debug, G: Sendable + Debug, H: Sendable + Debug, I: Sendable + Debug, J: Sendable + Debug> Sendable for (A, B, C, D, E, F, G, H, I, J)

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(reader: &mut dyn Read) -> Result<Self>

Source§

impl<A: Sendable + Debug, B: Sendable + Debug, C: Sendable + Debug, D: Sendable + Debug, E: Sendable + Debug, F: Sendable + Debug, G: Sendable + Debug, H: Sendable + Debug, I: Sendable + Debug, J: Sendable + Debug, K: Sendable + Debug> Sendable for (A, B, C, D, E, F, G, H, I, J, K)

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(reader: &mut dyn Read) -> Result<Self>

Source§

impl<A: Sendable + Debug, B: Sendable + Debug, C: Sendable + Debug, D: Sendable + Debug, E: Sendable + Debug, F: Sendable + Debug, G: Sendable + Debug, H: Sendable + Debug, I: Sendable + Debug, J: Sendable + Debug, K: Sendable + Debug, L: Sendable + Debug> Sendable for (A, B, C, D, E, F, G, H, I, J, K, L)

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(reader: &mut dyn Read) -> Result<Self>

Source§

impl<T> Sendable for Option<T>
where T: Sendable,

Source§

fn header(&self) -> PacketHeader<Self>

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl<T> Sendable for Box<T>
where T: Sendable + Copy,

Source§

fn header(&self) -> PacketHeader<Self>

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Source§

impl<T> Sendable for Vec<T>
where T: Sendable,

Source§

fn header(&self) -> PacketHeader<Self>

Source§

fn size(&self) -> u32

Source§

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

Source§

fn recv(data: &mut dyn Read) -> Result<Self>

Implementors§