Trait Encode

Source
pub trait Encode<'q, DB>
where DB: Database,
{ // Required method fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>; // Provided methods fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>> 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 Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

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 Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
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<'_, Sqlite> for Box<str>

Source§

fn encode( self, args: &mut Vec<SqliteArgumentValue<'_>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'_>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, Sqlite> for Box<[u8]>

Source§

fn encode( self, args: &mut Vec<SqliteArgumentValue<'_>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'_>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for &'q str

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for &'q [u8]

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for Cow<'_, str>

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for bool

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for f32

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for f64

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for i8

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for i16

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for i32

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for i64

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for isize

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for u8

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for u16

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for u32

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for u64

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for usize

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for Box<str>

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for Box<[u8]>

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for String

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for Vec<u8>

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, D1> for Decimal

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, Sqlite> for &'q str

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, Sqlite> for &'q [u8]

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, Sqlite> for Cow<'q, str>

Source§

fn encode( self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, Sqlite> for bool

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, Sqlite> for f32

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, Sqlite> for f64

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, Sqlite> for i8

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, Sqlite> for i16

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, Sqlite> for i32

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, Sqlite> for i64

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, Sqlite> for u8

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, Sqlite> for u16

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, Sqlite> for u32

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, Sqlite> for String

Source§

fn encode( self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q> Encode<'q, Sqlite> for Vec<u8>

Source§

fn encode( self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q, DB> Encode<'q, DB> for NonZero<i8>
where DB: Database, i8: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<i8>: Sized,

Source§

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

Source§

impl<'q, DB> Encode<'q, DB> for NonZero<i16>
where DB: Database, i16: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<i16>: Sized,

Source§

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

Source§

impl<'q, DB> Encode<'q, DB> for NonZero<i32>
where DB: Database, i32: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<i32>: Sized,

Source§

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

Source§

impl<'q, DB> Encode<'q, DB> for NonZero<i64>
where DB: Database, i64: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<i64>: Sized,

Source§

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

Source§

impl<'q, DB> Encode<'q, DB> for NonZero<u8>
where DB: Database, u8: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<u8>: Sized,

Source§

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

Source§

impl<'q, DB> Encode<'q, DB> for NonZero<u16>
where DB: Database, u16: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<u16>: Sized,

Source§

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

Source§

impl<'q, DB> Encode<'q, DB> for NonZero<u32>
where DB: Database, u32: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<u32>: Sized,

Source§

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

Source§

impl<'q, DB> Encode<'q, DB> for NonZero<u64>
where DB: Database, u64: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<u64>: Sized,

Source§

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

Source§

impl<'q, E> Encode<'q, D1> for Option<E>
where E: Encode<'q, D1>,

Type, Encode, Decode implementations for specific types

Source§

fn encode_by_ref( &self, buf: &mut <D1 as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

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

Source§

fn encode( self, buf: &mut <Sqlite as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, buf: &mut <Sqlite as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn size_hint(&self) -> usize

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 Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn size_hint(&self) -> usize

Implementors§

Source§

impl Encode<'_, D1> for NaiveDate

Source§

impl Encode<'_, D1> for NaiveDateTime

Source§

impl Encode<'_, D1> for NaiveTime

Source§

impl<'q> Encode<'q, D1> for Uuid

Source§

impl<'q> Encode<'q, D1> for Hyphenated

Source§

impl<'q> Encode<'q, D1> for Simple

Source§

impl<'q, DB> Encode<'q, DB> for Value
where Json<&'a Value>: for<'a> Encode<'q, DB>, DB: Database,

Source§

impl<'q, T> Encode<'q, D1> for Json<T>
where T: Serialize,

Source§

impl<'q, T> Encode<'q, D1> for Text<T>
where T: Display,

Source§

impl<'q, T> Encode<'q, Sqlite> for Text<T>
where T: Display,

Source§

impl<Tz> Encode<'_, D1> for DateTime<Tz>
where Tz: TimeZone,