pub trait FromSQLiteValue: Sized {
// Required methods
fn from_sqlite_integer(value: i64) -> Result<Self, DrizzleError>;
fn from_sqlite_text(value: &str) -> Result<Self, DrizzleError>;
fn from_sqlite_real(value: f64) -> Result<Self, DrizzleError>;
fn from_sqlite_blob(value: &[u8]) -> Result<Self, DrizzleError>;
// Provided method
fn from_sqlite_null() -> Result<Self, DrizzleError> { ... }
}Expand description
Trait for types that can be converted from SQLite values.
SQLite has 5 storage classes: NULL, INTEGER, REAL, TEXT, BLOB. This trait provides conversion methods for each type.
§Implementation Notes
- Implement the methods that make sense for your type
- Return
Errfor unsupported conversions SQLiteEnumderive automatically implements this trait
Required Methods§
Sourcefn from_sqlite_integer(value: i64) -> Result<Self, DrizzleError>
fn from_sqlite_integer(value: i64) -> Result<Self, DrizzleError>
Convert from a 64-bit integer value
Sourcefn from_sqlite_text(value: &str) -> Result<Self, DrizzleError>
fn from_sqlite_text(value: &str) -> Result<Self, DrizzleError>
Convert from a text/string value
Sourcefn from_sqlite_real(value: f64) -> Result<Self, DrizzleError>
fn from_sqlite_real(value: f64) -> Result<Self, DrizzleError>
Convert from a real/float value
Sourcefn from_sqlite_blob(value: &[u8]) -> Result<Self, DrizzleError>
fn from_sqlite_blob(value: &[u8]) -> Result<Self, DrizzleError>
Convert from a blob/binary value
Provided Methods§
Sourcefn from_sqlite_null() -> Result<Self, DrizzleError>
fn from_sqlite_null() -> Result<Self, DrizzleError>
Convert from a NULL value (default returns error)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.