little changes in key.rs

This commit is contained in:
Horhik 2021-03-24 07:50:58 +03:00
parent 3119403fa3
commit e11e72eab7
2 changed files with 2 additions and 2 deletions

View file

@ -13,4 +13,3 @@ description = "Implementation of FCPv2 freenet protocol"
[dependencies] [dependencies]
regex = "1.4.3" regex = "1.4.3"
rusqlite = "0.24.2" rusqlite = "0.24.2"
serde = { version = "1.0", features = ["derive"], optional = true }

View file

@ -8,13 +8,14 @@ pub struct SSK {
pub decrypt_key: String, pub decrypt_key: String,
pub settings: Option<String>, pub settings: Option<String>,
} }
/// converting SSK to rusqlite type
impl ToSql for SSK { impl ToSql for SSK {
fn to_sql(&self) -> Result<ToSqlOutput<'_>> { fn to_sql(&self) -> Result<ToSqlOutput<'_>> {
Ok(ToSqlOutput::from(self.convert())) Ok(ToSqlOutput::from(self.convert()))
} }
} }
/// converting from rusqlite type to SSK
impl FromSql for SSK{ impl FromSql for SSK{
fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self>{ fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self>{
match SSK::parse(value.as_str()?) { match SSK::parse(value.as_str()?) {