Trait sqlx::Encode

source ·
pub trait Encode<'q, DB>
where DB: Database,
{ // Required method fn encode_by_ref( &self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer ) -> IsNull; // Provided methods fn encode( self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer ) -> IsNull where Self: Sized { ... } fn produces(&self) -> Option<<DB as Database>::TypeInfo> { ... } fn size_hint(&self) -> usize { ... } }
Expand description

Encode a single value to be sent to the database.

Required Methods§

source

fn encode_by_ref( &self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer ) -> IsNull

Writes the value of self into buf without moving self.

Where possible, make use of encode instead as it can take advantage of re-using memory.

Provided Methods§

source

fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull
where Self: Sized,

Writes the value of self into buf in the expected format for the database.

source

fn produces(&self) -> Option<<DB as Database>::TypeInfo>

source

fn size_hint(&self) -> usize

Implementations on Foreign Types§

source§

impl Encode<'_, MySql> for &str

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl Encode<'_, MySql> for &[u8]

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl Encode<'_, MySql> for Cow<'_, str>

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl Encode<'_, MySql> for bool

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl Encode<'_, MySql> for f32

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl Encode<'_, MySql> for f64

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl Encode<'_, MySql> for i8

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl Encode<'_, MySql> for i16

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl Encode<'_, MySql> for i32

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl Encode<'_, MySql> for i64

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl Encode<'_, MySql> for u8

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl Encode<'_, MySql> for u16

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl Encode<'_, MySql> for u32

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl Encode<'_, MySql> for u64

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl Encode<'_, MySql> for String

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl Encode<'_, MySql> for Vec<u8>

source§

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

source§

impl<'q, T> Encode<'q, MySql> for Option<T>
where T: Encode<'q, MySql> + Type<MySql> + 'q,

source§

impl<'q, T, DB> Encode<'q, DB> for &T
where DB: Database, T: Encode<'q, DB>,

source§

fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull

source§

fn encode_by_ref( &self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer ) -> IsNull

source§

fn produces(&self) -> Option<<DB as Database>::TypeInfo>

source§

fn size_hint(&self) -> usize

Implementors§