Skip to main content

Encode

Trait Encode 

Source
pub trait Encode: TextEncode + BinaryEncode {
    // Required method
    fn oid() -> u32;

    // Provided method
    fn encode(&self, format: Format, buf: &mut Vec<u8>) { ... }
}
Expand description

Combined encoding trait that supports both formats.

Required Methods§

Source

fn oid() -> u32

Get the PostgreSQL OID for this type.

Provided Methods§

Source

fn encode(&self, format: Format, buf: &mut Vec<u8>)

Encode to the specified format.

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 Encode for bool

Source§

impl Encode for f32

Source§

impl Encode for f64

Source§

impl Encode for i16

Source§

impl Encode for i32

Source§

impl Encode for i64

Source§

impl Encode for String

Source§

impl Encode for Vec<u8>

Implementors§