Skip to content

Commit

Permalink
fix rusqlite feature
Browse files Browse the repository at this point in the history
  • Loading branch information
kkohbrok committed Mar 26, 2024
1 parent 49c3770 commit b002a4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ serde = { version = "1.0", features = ["derive"] }
uuid = { version = "1", features = ["serde", "v4"] }
thiserror = "1.0"
openmls = { git = "https://github.com/openmls/openmls" }
rusqlite = { version = "0.31", optional = true }
rusqlite = { version = "0.31", features = ["uuid"], optional = true }

[features]
rusqlite = ["dep:rusqlite"]
6 changes: 3 additions & 3 deletions types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,16 @@ impl TryFrom<&[u8]> for DsClientId {
impl ToSql for DsClientId {
fn to_sql(&self) -> rusqlite::Result<rusqlite::types::ToSqlOutput<'_>> {
Ok(rusqlite::types::ToSqlOutput::Borrowed(
rusqlite::types::ValueRef::Blob(self.id.as_bytes()),
rusqlite::types::ValueRef::Blob(self.id.as_slice()),
))
}
}

#[cfg(feature = "rusqlite")]
impl FromSql for DsClientId {
fn column_result(value: rusqlite::types::ValueRef<'_>) -> rusqlite::types::FromSqlResult<Self> {
let uuid = Uuid::column_result(value)?;
Ok(uuid.into())
let id = <[u8; 32]>::column_result(value)?;
Ok(Self { id })
}
}

Expand Down

0 comments on commit b002a4f

Please sign in to comment.