Skip to main content

WriteToHeader

Trait WriteToHeader 

Source
pub trait WriteToHeader {
    // Required method
    fn write_to(&self, writer: &mut Writer) -> Result<usize>;

    // Provided method
    fn to_bytes(&self) -> Result<Vec<u8>> { ... }
}
Expand description

Defines how to write a type as part of a binary PROXY protocol header.

Required Methods§

Source

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Write this instance to the given Writer. The Writer returns an IO error when an individual byte slice is longer than u16::MAX. However, the total length of the buffer may exceed u16::MAX.

Provided Methods§

Source

fn to_bytes(&self) -> Result<Vec<u8>>

Writes this instance to a temporary buffer and returns the buffer.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl WriteToHeader for [u8]

Source§

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Source§

impl WriteToHeader for i8

Source§

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Source§

impl WriteToHeader for i16

Source§

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Source§

impl WriteToHeader for i32

Source§

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Source§

impl WriteToHeader for i64

Source§

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Source§

impl WriteToHeader for i128

Source§

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Source§

impl WriteToHeader for isize

Source§

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Source§

impl WriteToHeader for u8

Source§

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Source§

impl WriteToHeader for u16

Source§

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Source§

impl WriteToHeader for u32

Source§

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Source§

impl WriteToHeader for u64

Source§

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Source§

impl WriteToHeader for u128

Source§

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Source§

impl WriteToHeader for usize

Source§

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Source§

impl<T: ?Sized + WriteToHeader> WriteToHeader for &T

Source§

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Source§

impl<T: Copy + Into<u8>> WriteToHeader for (T, &[u8])

Source§

fn write_to(&self, writer: &mut Writer) -> Result<usize>

Implementors§