Trait sqlx_core::encode::Encode [−][src]
pub trait Encode<'q, DB: Database> { #[must_use] fn encode_by_ref(
&self,
buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer
) -> IsNull; #[must_use] fn encode(
self,
buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer
) -> IsNull
where
Self: Sized, { ... } fn produces(&self) -> Option<DB::TypeInfo> { ... } fn size_hint(&self) -> usize { ... } }
Expand description
Encode a single value to be sent to the database.
Required methods
#[must_use]fn encode_by_ref(
&self,
buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer
) -> IsNull[src]
#[must_use]fn encode_by_ref(
&self,
buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer
) -> IsNull[src]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
Implementations on Foreign Types
impl<'q, T, DB: Database> Encode<'q, DB> for &T where
T: Encode<'q, DB>, [src]
impl<'q, T, DB: Database> Encode<'q, DB> for &T where
T: Encode<'q, DB>, [src]fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull[src]
fn encode_by_ref(
&self,
buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer
) -> IsNull[src]
&self,
buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer
) -> IsNull
fn produces(&self) -> Option<DB::TypeInfo>[src]
fn size_hint(&self) -> usize[src]
impl<'q, DB> Encode<'q, DB> for JsonValue where
Json<&'a Self>: Encode<'q, DB>,
DB: Database, [src]
impl<'q, DB> Encode<'q, DB> for JsonValue where
Json<&'a Self>: Encode<'q, DB>,
DB: Database, [src]fn encode_by_ref(
&self,
buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer
) -> IsNull[src]
&self,
buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer
) -> IsNull
impl<'q> Encode<'q, Any> for bool where
bool: AnyEncode<'q>, [src]
impl<'q> Encode<'q, Any> for bool where
bool: AnyEncode<'q>, [src]fn encode_by_ref(&self, buf: &mut AnyArgumentBuffer<'q>) -> IsNull[src]
impl<'q> Encode<'q, Any> for i32 where
i32: AnyEncode<'q>, [src]
impl<'q> Encode<'q, Any> for i32 where
i32: AnyEncode<'q>, [src]fn encode_by_ref(&self, buf: &mut AnyArgumentBuffer<'q>) -> IsNull[src]
impl<'q> Encode<'q, Any> for i64 where
i64: AnyEncode<'q>, [src]
impl<'q> Encode<'q, Any> for i64 where
i64: AnyEncode<'q>, [src]fn encode_by_ref(&self, buf: &mut AnyArgumentBuffer<'q>) -> IsNull[src]
impl<'q> Encode<'q, Any> for f32 where
f32: AnyEncode<'q>, [src]
impl<'q> Encode<'q, Any> for f32 where
f32: AnyEncode<'q>, [src]fn encode_by_ref(&self, buf: &mut AnyArgumentBuffer<'q>) -> IsNull[src]
impl<'q> Encode<'q, Any> for f64 where
f64: AnyEncode<'q>, [src]
impl<'q> Encode<'q, Any> for f64 where
f64: AnyEncode<'q>, [src]fn encode_by_ref(&self, buf: &mut AnyArgumentBuffer<'q>) -> IsNull[src]
impl<'q> Encode<'q, Any> for &'q str where
&'q str: AnyEncode<'q>, [src]
impl<'q> Encode<'q, Any> for &'q str where
&'q str: AnyEncode<'q>, [src]fn encode_by_ref(&self, buf: &mut AnyArgumentBuffer<'q>) -> IsNull[src]
impl<'q> Encode<'q, Any> for String where
String: AnyEncode<'q>, [src]
impl<'q> Encode<'q, Any> for String where
String: AnyEncode<'q>, [src]fn encode_by_ref(&self, buf: &mut AnyArgumentBuffer<'q>) -> IsNull[src]
impl<'q, T> Encode<'q, Any> for Option<T> where
T: Encode<'q, Any> + Type<Any> + 'q, [src]
impl<'q, T> Encode<'q, Any> for Option<T> where
T: Encode<'q, Any> + Type<Any> + 'q, [src]fn produces(&self) -> Option<<Any as Database>::TypeInfo>[src]
fn encode(self, buf: &mut <Any as HasArguments<'q>>::ArgumentBuffer) -> IsNull[src]
fn encode_by_ref(
&self,
buf: &mut <Any as HasArguments<'q>>::ArgumentBuffer
) -> IsNull[src]
&self,
buf: &mut <Any as HasArguments<'q>>::ArgumentBuffer
) -> IsNull
fn size_hint(&self) -> usize[src]
impl<'q, T> Encode<'q, Postgres> for Vec<T> where
&'a [T]: Encode<'q, Postgres>,
T: Encode<'q, Postgres>, [src]
impl<'q, T> Encode<'q, Postgres> for Vec<T> where
&'a [T]: Encode<'q, Postgres>,
T: Encode<'q, Postgres>, [src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl<'q, T> Encode<'q, Postgres> for &[T] where
T: Encode<'q, Postgres> + Type<Postgres>, [src]
impl<'q, T> Encode<'q, Postgres> for &[T] where
T: Encode<'q, Postgres> + Type<Postgres>, [src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl Encode<'_, Postgres> for bool[src]
impl Encode<'_, Postgres> for bool[src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl Encode<'_, Postgres> for &[u8][src]
impl Encode<'_, Postgres> for &[u8][src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl Encode<'_, Postgres> for Vec<u8>[src]
impl Encode<'_, Postgres> for Vec<u8>[src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl Encode<'_, Postgres> for f32[src]
impl Encode<'_, Postgres> for f32[src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl Encode<'_, Postgres> for f64[src]
impl Encode<'_, Postgres> for f64[src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl Encode<'_, Postgres> for i8[src]
impl Encode<'_, Postgres> for i8[src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl Encode<'_, Postgres> for i16[src]
impl Encode<'_, Postgres> for i16[src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl Encode<'_, Postgres> for u32[src]
impl Encode<'_, Postgres> for u32[src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl Encode<'_, Postgres> for i32[src]
impl Encode<'_, Postgres> for i32[src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl Encode<'_, Postgres> for i64[src]
impl Encode<'_, Postgres> for i64[src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl Encode<'_, Postgres> for &str[src]
impl Encode<'_, Postgres> for &str[src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl Encode<'_, Postgres> for String[src]
impl Encode<'_, Postgres> for String[src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl Encode<'_, Postgres> for BigDecimal[src]
impl Encode<'_, Postgres> for BigDecimal[src]Panics
If this BigDecimal cannot be represented by PgNumeric.
impl Encode<'_, Postgres> for Decimal[src]
impl Encode<'_, Postgres> for Decimal[src]Panics
If this Decimal cannot be represented by PgNumeric.
fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl Encode<'_, Postgres> for NaiveDateTime[src]
impl Encode<'_, Postgres> for NaiveDateTime[src]impl Encode<'_, Postgres> for PrimitiveDateTime[src]
impl Encode<'_, Postgres> for PrimitiveDateTime[src]impl Encode<'_, Postgres> for OffsetDateTime[src]
impl Encode<'_, Postgres> for OffsetDateTime[src]impl Encode<'_, Postgres> for Uuid[src]
impl Encode<'_, Postgres> for Uuid[src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl<'q, T> Encode<'q, Postgres> for Option<T> where
T: Encode<'q, Postgres> + Type<Postgres> + 'q, [src]
impl<'q, T> Encode<'q, Postgres> for Option<T> where
T: Encode<'q, Postgres> + Type<Postgres> + 'q, [src]fn produces(&self) -> Option<<Postgres as Database>::TypeInfo>[src]
fn encode(
self,
buf: &mut <Postgres as HasArguments<'q>>::ArgumentBuffer
) -> IsNull[src]
self,
buf: &mut <Postgres as HasArguments<'q>>::ArgumentBuffer
) -> IsNull
fn encode_by_ref(
&self,
buf: &mut <Postgres as HasArguments<'q>>::ArgumentBuffer
) -> IsNull[src]
&self,
buf: &mut <Postgres as HasArguments<'q>>::ArgumentBuffer
) -> IsNull
fn size_hint(&self) -> usize[src]
impl<'q> Encode<'q, Sqlite> for bool[src]
impl<'q> Encode<'q, Sqlite> for bool[src]fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<'q> Encode<'q, Sqlite> for &'q [u8][src]
impl<'q> Encode<'q, Sqlite> for &'q [u8][src]fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<'q> Encode<'q, Sqlite> for Vec<u8>[src]
impl<'q> Encode<'q, Sqlite> for Vec<u8>[src]fn encode(self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<Tz: TimeZone> Encode<'_, Sqlite> for DateTime<Tz> where
Tz::Offset: Display, [src]
impl<Tz: TimeZone> Encode<'_, Sqlite> for DateTime<Tz> where
Tz::Offset: Display, [src]fn encode_by_ref(&self, buf: &mut Vec<SqliteArgumentValue<'_>>) -> IsNull[src]
impl Encode<'_, Sqlite> for NaiveDateTime[src]
impl Encode<'_, Sqlite> for NaiveDateTime[src]fn encode_by_ref(&self, buf: &mut Vec<SqliteArgumentValue<'_>>) -> IsNull[src]
impl Encode<'_, Sqlite> for NaiveDate[src]
impl Encode<'_, Sqlite> for NaiveDate[src]fn encode_by_ref(&self, buf: &mut Vec<SqliteArgumentValue<'_>>) -> IsNull[src]
impl Encode<'_, Sqlite> for NaiveTime[src]
impl Encode<'_, Sqlite> for NaiveTime[src]fn encode_by_ref(&self, buf: &mut Vec<SqliteArgumentValue<'_>>) -> IsNull[src]
impl<'q> Encode<'q, Sqlite> for f32[src]
impl<'q> Encode<'q, Sqlite> for f32[src]fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<'q> Encode<'q, Sqlite> for f64[src]
impl<'q> Encode<'q, Sqlite> for f64[src]fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<'q> Encode<'q, Sqlite> for i8[src]
impl<'q> Encode<'q, Sqlite> for i8[src]fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<'q> Encode<'q, Sqlite> for i16[src]
impl<'q> Encode<'q, Sqlite> for i16[src]fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<'q> Encode<'q, Sqlite> for i32[src]
impl<'q> Encode<'q, Sqlite> for i32[src]fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<'q> Encode<'q, Sqlite> for i64[src]
impl<'q> Encode<'q, Sqlite> for i64[src]fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<'q> Encode<'q, Sqlite> for &'q str[src]
impl<'q> Encode<'q, Sqlite> for &'q str[src]fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<'q> Encode<'q, Sqlite> for String[src]
impl<'q> Encode<'q, Sqlite> for String[src]fn encode(self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<'q> Encode<'q, Sqlite> for u8[src]
impl<'q> Encode<'q, Sqlite> for u8[src]fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<'q> Encode<'q, Sqlite> for u16[src]
impl<'q> Encode<'q, Sqlite> for u16[src]fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<'q> Encode<'q, Sqlite> for u32[src]
impl<'q> Encode<'q, Sqlite> for u32[src]fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<'q> Encode<'q, Sqlite> for Uuid[src]
impl<'q> Encode<'q, Sqlite> for Uuid[src]fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<'q> Encode<'q, Sqlite> for Hyphenated[src]
impl<'q> Encode<'q, Sqlite> for Hyphenated[src]fn encode_by_ref(&self, args: &mut Vec<SqliteArgumentValue<'q>>) -> IsNull[src]
impl<'q, T> Encode<'q, Sqlite> for Option<T> where
T: Encode<'q, Sqlite> + Type<Sqlite> + 'q, [src]
impl<'q, T> Encode<'q, Sqlite> for Option<T> where
T: Encode<'q, Sqlite> + Type<Sqlite> + 'q, [src]fn produces(&self) -> Option<<Sqlite as Database>::TypeInfo>[src]
fn encode(
self,
buf: &mut <Sqlite as HasArguments<'q>>::ArgumentBuffer
) -> IsNull[src]
self,
buf: &mut <Sqlite as HasArguments<'q>>::ArgumentBuffer
) -> IsNull
fn encode_by_ref(
&self,
buf: &mut <Sqlite as HasArguments<'q>>::ArgumentBuffer
) -> IsNull[src]
&self,
buf: &mut <Sqlite as HasArguments<'q>>::ArgumentBuffer
) -> IsNull
fn size_hint(&self) -> usize[src]
impl Encode<'_, MySql> for BigDecimal[src]
impl Encode<'_, MySql> for BigDecimal[src]fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull[src]
impl Encode<'_, MySql> for DateTime<Utc>[src]
impl Encode<'_, MySql> for DateTime<Utc>[src]fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull[src]
impl Encode<'_, MySql> for NaiveDateTime[src]
impl Encode<'_, MySql> for NaiveDateTime[src]impl Encode<'_, MySql> for OffsetDateTime[src]
impl Encode<'_, MySql> for OffsetDateTime[src]fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull[src]
impl Encode<'_, MySql> for PrimitiveDateTime[src]
impl Encode<'_, MySql> for PrimitiveDateTime[src]impl Encode<'_, MySql> for Hyphenated[src]
impl Encode<'_, MySql> for Hyphenated[src]fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull[src]
impl<'q, T> Encode<'q, MySql> for Option<T> where
T: Encode<'q, MySql> + Type<MySql> + 'q, [src]
impl<'q, T> Encode<'q, MySql> for Option<T> where
T: Encode<'q, MySql> + Type<MySql> + 'q, [src]fn produces(&self) -> Option<<MySql as Database>::TypeInfo>[src]
fn encode(self, buf: &mut <MySql as HasArguments<'q>>::ArgumentBuffer) -> IsNull[src]
fn encode_by_ref(
&self,
buf: &mut <MySql as HasArguments<'q>>::ArgumentBuffer
) -> IsNull[src]
&self,
buf: &mut <MySql as HasArguments<'q>>::ArgumentBuffer
) -> IsNull
fn size_hint(&self) -> usize[src]
impl Encode<'_, Mssql> for &str[src]
impl Encode<'_, Mssql> for &str[src]fn produces(&self) -> Option<MssqlTypeInfo>[src]
fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull[src]
impl Encode<'_, Mssql> for String[src]
impl Encode<'_, Mssql> for String[src]fn produces(&self) -> Option<MssqlTypeInfo>[src]
fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull[src]
Implementors
impl Encode<'_, Postgres> for PgInterval[src]
impl Encode<'_, Postgres> for PgInterval[src]impl Encode<'_, Postgres> for PgMoney[src]
impl Encode<'_, Postgres> for PgMoney[src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl<'q, T> Encode<'q, Postgres> for PgRange<T> where
T: Encode<'q, Postgres>, [src]
impl<'q, T> Encode<'q, Postgres> for PgRange<T> where
T: Encode<'q, Postgres>, [src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl<'q, T> Encode<'q, Postgres> for Json<T> where
T: Serialize, [src]
impl<'q, T> Encode<'q, Postgres> for Json<T> where
T: Serialize, [src]fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]
impl<T> Encode<'_, MySql> for Json<T> where
T: Serialize, [src]
impl<T> Encode<'_, MySql> for Json<T> where
T: Serialize, [src]fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull[src]
impl<T> Encode<'_, Sqlite> for Json<T> where
T: Serialize, [src]
impl<T> Encode<'_, Sqlite> for Json<T> where
T: Serialize, [src]