rama::proxy::haproxy::protocol::v2

Trait WriteToHeader

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

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

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

Required Methods§

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

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§

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

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

Implementations on Foreign Types§

§

impl WriteToHeader for i8

§

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

§

impl WriteToHeader for i16

§

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

§

impl WriteToHeader for i32

§

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

§

impl WriteToHeader for i64

§

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

§

impl WriteToHeader for i128

§

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

§

impl WriteToHeader for isize

§

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

§

impl WriteToHeader for u8

§

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

§

impl WriteToHeader for u16

§

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

§

impl WriteToHeader for u32

§

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

§

impl WriteToHeader for u64

§

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

§

impl WriteToHeader for u128

§

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

§

impl WriteToHeader for usize

§

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

§

impl WriteToHeader for [u8]

§

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

§

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

§

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

§

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

§

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

Implementors§