Skip to main content

ToProtocolValue

Trait ToProtocolValue 

Source
pub trait ToProtocolValue: Debug {
    // Required methods
    fn to_text(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>
       where Self: Sized;
    fn to_binary(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>
       where Self: Sized;

    // Provided method
    fn to_protocol(
        &self,
        buf: &mut BytesMut,
        format: Format,
    ) -> Result<(), ProtocolError>
       where Self: Sized { ... }
}
Expand description

This trait explains how to encode values to the protocol format

Required Methods§

Source

fn to_text(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>
where Self: Sized,

Converts native type to raw value in text format

Source

fn to_binary(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>
where Self: Sized,

Converts native type to raw value in binary format

Provided Methods§

Source

fn to_protocol( &self, buf: &mut BytesMut, format: Format, ) -> Result<(), ProtocolError>
where Self: Sized,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl ToProtocolValue for bool

Source§

fn to_text(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

fn to_binary(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

impl ToProtocolValue for f32

Source§

fn to_text(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

fn to_binary(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

impl ToProtocolValue for f64

Source§

fn to_text(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

fn to_binary(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

impl ToProtocolValue for i8

Source§

fn to_text(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

fn to_binary(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

impl ToProtocolValue for i16

Source§

fn to_text(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

fn to_binary(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

impl ToProtocolValue for i32

Source§

fn to_text(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

fn to_binary(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

impl ToProtocolValue for i64

Source§

fn to_text(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

fn to_binary(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

impl ToProtocolValue for String

Source§

fn to_text(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

fn to_binary(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

impl<T: ToProtocolValue> ToProtocolValue for Option<T>

Source§

fn to_text(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Source§

fn to_binary(&self, buf: &mut BytesMut) -> Result<(), ProtocolError>

Implementors§