docs: extend documentation on Encode/Decode

This commit is contained in:
Ryan Leckey
2020-06-16 03:32:35 -07:00
parent 11e21e201c
commit 5ac7601fe2
6 changed files with 20 additions and 14 deletions

View File

@@ -1,4 +1,5 @@
//! Types and traits for encoding values to the database.
//! Provides [`Encode`](trait.Encode.html) for encoding values for the database.
use std::mem;
use crate::database::{Database, HasArguments};
@@ -48,11 +49,6 @@ impl<'q, T, DB: Database> Encode<'q, DB> for &'_ T
where
T: Encode<'q, DB>,
{
#[inline]
fn produces(&self) -> Option<DB::TypeInfo> {
(**self).produces()
}
#[inline]
fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull {
<T as Encode<DB>>::encode_by_ref(self, buf)
@@ -63,6 +59,11 @@ where
<&T as Encode<DB>>::encode(self, buf)
}
#[inline]
fn produces(&self) -> Option<DB::TypeInfo> {
(**self).produces()
}
#[inline]
fn size_hint(&self) -> usize {
(**self).size_hint()