Trait serde_db::ser::DbvFactory
source · pub trait DbvFactory: Sized {
type DBV;
Show 16 methods
fn from_bool(&self, value: bool) -> Result<Self::DBV, SerializationError>;
fn from_i8(&self, value: i8) -> Result<Self::DBV, SerializationError>;
fn from_i16(&self, value: i16) -> Result<Self::DBV, SerializationError>;
fn from_i32(&self, value: i32) -> Result<Self::DBV, SerializationError>;
fn from_i64(&self, value: i64) -> Result<Self::DBV, SerializationError>;
fn from_u8(&self, value: u8) -> Result<Self::DBV, SerializationError>;
fn from_u16(&self, value: u16) -> Result<Self::DBV, SerializationError>;
fn from_u32(&self, value: u32) -> Result<Self::DBV, SerializationError>;
fn from_u64(&self, value: u64) -> Result<Self::DBV, SerializationError>;
fn from_f32(&self, value: f32) -> Result<Self::DBV, SerializationError>;
fn from_f64(&self, value: f64) -> Result<Self::DBV, SerializationError>;
fn from_char(&self, value: char) -> Result<Self::DBV, SerializationError>;
fn from_str(&self, value: &str) -> Result<Self::DBV, SerializationError>;
fn from_bytes(&self, value: &[u8]) -> Result<Self::DBV, SerializationError>;
fn from_none(&self) -> Result<Self::DBV, SerializationError>;
fn descriptor(&self) -> &'static str;
}
Expand description
A factory for database objects.
This trait is ot be implemented by descriptors of parameters for database commands.
Example
A parameter descriptor for a String-valued database type might implement all methods with adequate conversions, while a parameter descriptor for an integer type might only support conversions from the rust integer types.
Required Associated Types§
Required Methods§
sourcefn from_bytes(&self, value: &[u8]) -> Result<Self::DBV, SerializationError>
fn from_bytes(&self, value: &[u8]) -> Result<Self::DBV, SerializationError>
Serialize bytes.
sourcefn from_none(&self) -> Result<Self::DBV, SerializationError>
fn from_none(&self) -> Result<Self::DBV, SerializationError>
Serialize a none.
sourcefn descriptor(&self) -> &'static str
fn descriptor(&self) -> &'static str
Provide a descriptive String of the type that is required (for error messages).