mirror of
https://github.com/isar/rusqlite.git
synced 2025-08-20 21:09:31 +08:00
@@ -15,15 +15,17 @@ pub enum FromSqlError {
|
||||
/// requested type.
|
||||
OutOfRange(i64),
|
||||
|
||||
/// `feature = "i128_blob"` Error returned when reading an `i128` from a
|
||||
/// Error returned when reading an `i128` from a
|
||||
/// blob with a size other than 16. Only available when the `i128_blob`
|
||||
/// feature is enabled.
|
||||
#[cfg(feature = "i128_blob")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "i128_blob")))]
|
||||
InvalidI128Size(usize),
|
||||
|
||||
/// `feature = "uuid"` Error returned when reading a `uuid` from a blob with
|
||||
/// Error returned when reading a `uuid` from a blob with
|
||||
/// a size other than 16. Only available when the `uuid` feature is enabled.
|
||||
#[cfg(feature = "uuid")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "uuid")))]
|
||||
InvalidUuidSize(usize),
|
||||
|
||||
/// An error case available for implementors of the [`FromSql`] trait.
|
||||
@@ -176,6 +178,7 @@ impl FromSql for Vec<u8> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "i128_blob")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "i128_blob")))]
|
||||
impl FromSql for i128 {
|
||||
#[inline]
|
||||
fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self> {
|
||||
@@ -192,6 +195,7 @@ impl FromSql for i128 {
|
||||
}
|
||||
|
||||
#[cfg(feature = "uuid")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "uuid")))]
|
||||
impl FromSql for uuid::Uuid {
|
||||
#[inline]
|
||||
fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self> {
|
||||
|
@@ -75,14 +75,18 @@ pub use self::value_ref::ValueRef;
|
||||
use std::fmt;
|
||||
|
||||
#[cfg(feature = "chrono")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "chrono")))]
|
||||
mod chrono;
|
||||
mod from_sql;
|
||||
#[cfg(feature = "serde_json")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "serde_json")))]
|
||||
mod serde_json;
|
||||
#[cfg(feature = "time")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "time")))]
|
||||
mod time;
|
||||
mod to_sql;
|
||||
#[cfg(feature = "url")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "url")))]
|
||||
mod url;
|
||||
mod value;
|
||||
mod value_ref;
|
||||
|
@@ -16,13 +16,15 @@ pub enum ToSqlOutput<'a> {
|
||||
/// An owned SQLite-representable value.
|
||||
Owned(Value),
|
||||
|
||||
/// `feature = "blob"` A BLOB of the given length that is filled with
|
||||
/// A BLOB of the given length that is filled with
|
||||
/// zeroes.
|
||||
#[cfg(feature = "blob")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "blob")))]
|
||||
ZeroBlob(i32),
|
||||
|
||||
/// `feature = "array"`
|
||||
#[cfg(feature = "array")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "array")))]
|
||||
Array(Array),
|
||||
}
|
||||
|
||||
@@ -70,9 +72,11 @@ from_value!(Vec<u8>);
|
||||
// `i128` needs in `Into<Value>`, but it's probably fine for the moment, and not
|
||||
// worth adding another case to Value.
|
||||
#[cfg(feature = "i128_blob")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "i128_blob")))]
|
||||
from_value!(i128);
|
||||
|
||||
#[cfg(feature = "uuid")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "uuid")))]
|
||||
from_value!(uuid::Uuid);
|
||||
|
||||
impl ToSql for ToSqlOutput<'_> {
|
||||
@@ -162,9 +166,11 @@ to_sql_self!(f32);
|
||||
to_sql_self!(f64);
|
||||
|
||||
#[cfg(feature = "i128_blob")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "i128_blob")))]
|
||||
to_sql_self!(i128);
|
||||
|
||||
#[cfg(feature = "uuid")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "uuid")))]
|
||||
to_sql_self!(uuid::Uuid);
|
||||
|
||||
macro_rules! to_sql_self_fallible(
|
||||
|
@@ -41,6 +41,7 @@ impl From<isize> for Value {
|
||||
}
|
||||
|
||||
#[cfg(feature = "i128_blob")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "i128_blob")))]
|
||||
impl From<i128> for Value {
|
||||
#[inline]
|
||||
fn from(i: i128) -> Value {
|
||||
@@ -54,6 +55,7 @@ impl From<i128> for Value {
|
||||
}
|
||||
|
||||
#[cfg(feature = "uuid")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "uuid")))]
|
||||
impl From<uuid::Uuid> for Value {
|
||||
#[inline]
|
||||
fn from(id: uuid::Uuid) -> Value {
|
||||
|
Reference in New Issue
Block a user