diff options
Diffstat (limited to 'jid')
-rw-r--r-- | jid/Cargo.toml | 2 | ||||
-rw-r--r-- | jid/src/lib.rs | 60 |
2 files changed, 31 insertions, 31 deletions
diff --git a/jid/Cargo.toml b/jid/Cargo.toml index b8f4956..58d59a4 100644 --- a/jid/Cargo.toml +++ b/jid/Cargo.toml @@ -10,7 +10,7 @@ serde = ["dep:serde"] # sqlx = ["dep:sqlx"] [dependencies] -serde = { version = "1.0.219", features = ["derive"], optional = true } +serde = { workspace = true, features = ["derive"], optional = true } rusqlite = { git = "https://github.com/Spxg/rusqlite.git", optional = true, branch = "wasm-demo" } # sqlx = { version = "0.8.3", features = ["sqlite"], optional = true } # sqlx = { path = "../../remote/sqlx", features = ["sqlite"], optional = true } diff --git a/jid/src/lib.rs b/jid/src/lib.rs index 2499ca8..47ca497 100644 --- a/jid/src/lib.rs +++ b/jid/src/lib.rs @@ -1,7 +1,7 @@ use std::{borrow::Cow, error::Error, fmt::Display, str::FromStr}; -#[cfg(feature = "sqlx")] -use sqlx::Sqlite; +// #[cfg(feature = "sqlx")] +// use sqlx::Sqlite; #[derive(PartialEq, Debug, Clone, Eq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] @@ -57,34 +57,34 @@ impl From<ParseError> for rusqlite::types::FromSqlError { } } -#[cfg(feature = "sqlx")] -impl sqlx::Type<Sqlite> for JID { - fn type_info() -> <Sqlite as sqlx::Database>::TypeInfo { - <&str as sqlx::Type<Sqlite>>::type_info() - } -} - -#[cfg(feature = "sqlx")] -impl sqlx::Decode<'_, Sqlite> for JID { - fn decode( - value: <Sqlite as sqlx::Database>::ValueRef<'_>, - ) -> Result<Self, sqlx::error::BoxDynError> { - let value = <&str as sqlx::Decode<Sqlite>>::decode(value)?; - - Ok(value.parse()?) - } -} - -#[cfg(feature = "sqlx")] -impl sqlx::Encode<'_, Sqlite> for JID { - fn encode_by_ref( - &self, - buf: &mut <Sqlite as sqlx::Database>::ArgumentBuffer<'_>, - ) -> Result<sqlx::encode::IsNull, sqlx::error::BoxDynError> { - let jid = self.to_string(); - <String as sqlx::Encode<Sqlite>>::encode(jid, buf) - } -} +// #[cfg(feature = "sqlx")] +// impl sqlx::Type<Sqlite> for JID { +// fn type_info() -> <Sqlite as sqlx::Database>::TypeInfo { +// <&str as sqlx::Type<Sqlite>>::type_info() +// } +// } + +// #[cfg(feature = "sqlx")] +// impl sqlx::Decode<'_, Sqlite> for JID { +// fn decode( +// value: <Sqlite as sqlx::Database>::ValueRef<'_>, +// ) -> Result<Self, sqlx::error::BoxDynError> { +// let value = <&str as sqlx::Decode<Sqlite>>::decode(value)?; + +// Ok(value.parse()?) +// } +// } + +// #[cfg(feature = "sqlx")] +// impl sqlx::Encode<'_, Sqlite> for JID { +// fn encode_by_ref( +// &self, +// buf: &mut <Sqlite as sqlx::Database>::ArgumentBuffer<'_>, +// ) -> Result<sqlx::encode::IsNull, sqlx::error::BoxDynError> { +// let jid = self.to_string(); +// <String as sqlx::Encode<Sqlite>>::encode(jid, buf) +// } +// } #[derive(Debug, Clone)] pub enum JIDError { |