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§
Sourcefn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
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§
Sourcefn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>where
Self: Sized,
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.
fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
Implementations on Foreign Types§
Source§impl<'q, DB> Encode<'q, DB> for NonZero<i8>
impl<'q, DB> Encode<'q, DB> for NonZero<i8>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn produces(&self) -> Option<<DB as Database>::TypeInfo>
Source§impl<'q, DB> Encode<'q, DB> for NonZero<i16>
impl<'q, DB> Encode<'q, DB> for NonZero<i16>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn produces(&self) -> Option<<DB as Database>::TypeInfo>
Source§impl<'q, DB> Encode<'q, DB> for NonZero<i32>
impl<'q, DB> Encode<'q, DB> for NonZero<i32>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn produces(&self) -> Option<<DB as Database>::TypeInfo>
Source§impl<'q, DB> Encode<'q, DB> for NonZero<i64>
impl<'q, DB> Encode<'q, DB> for NonZero<i64>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn produces(&self) -> Option<<DB as Database>::TypeInfo>
Source§impl<'q, DB> Encode<'q, DB> for NonZero<u8>
impl<'q, DB> Encode<'q, DB> for NonZero<u8>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn produces(&self) -> Option<<DB as Database>::TypeInfo>
Source§impl<'q, DB> Encode<'q, DB> for NonZero<u16>
impl<'q, DB> Encode<'q, DB> for NonZero<u16>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn produces(&self) -> Option<<DB as Database>::TypeInfo>
Source§impl<'q, DB> Encode<'q, DB> for NonZero<u32>
impl<'q, DB> Encode<'q, DB> for NonZero<u32>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn produces(&self) -> Option<<DB as Database>::TypeInfo>
Source§impl<'q, DB> Encode<'q, DB> for NonZero<u64>
impl<'q, DB> Encode<'q, DB> for NonZero<u64>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn produces(&self) -> Option<<DB as Database>::TypeInfo>
Source§impl<'q, E> Encode<'q, D1> for Option<E>
Type
, Encode
, Decode
implementations for specific types
impl<'q, E> Encode<'q, D1> for Option<E>
Type
, Encode
, Decode
implementations for specific types