From 2e1d39fcf80e5fca229516995be8832f5ded74fe Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Tue, 25 Oct 2022 06:05:02 -0700 Subject: [PATCH] Remove unused Response to Value conversion implementation --- lib/src/dbs/response.rs | 23 ----------------------- lib/src/sql/value/value.rs | 12 ------------ 2 files changed, 35 deletions(-) diff --git a/lib/src/dbs/response.rs b/lib/src/dbs/response.rs index 1c523656..9f37cce4 100644 --- a/lib/src/dbs/response.rs +++ b/lib/src/dbs/response.rs @@ -1,6 +1,5 @@ use crate::err::Error; use crate::sql::value::Value; -use crate::sql::Object; use serde::ser::SerializeStruct; use serde::Serialize; use std::time::Duration; @@ -26,28 +25,6 @@ impl Response { } } -impl From for Value { - fn from(v: Response) -> Value { - // Get the response speed - let time = v.speed(); - // Get the response status - let status = v.output().map_or_else(|_| "ERR", |_| "OK"); - // Convert the response - match v.result { - Ok(val) => Value::Object(Object(map! { - String::from("time") => time.into(), - String::from("status") => status.into(), - String::from("result") => val, - })), - Err(err) => Value::Object(Object(map! { - String::from("time") => time.into(), - String::from("status") => status.into(), - String::from("detail") => err.to_string().into(), - })), - } - } -} - impl Serialize for Response { fn serialize(&self, serializer: S) -> Result where diff --git a/lib/src/sql/value/value.rs b/lib/src/sql/value/value.rs index 914b1321..4f0805d4 100644 --- a/lib/src/sql/value/value.rs +++ b/lib/src/sql/value/value.rs @@ -2,7 +2,6 @@ use crate::ctx::Context; use crate::dbs::Options; -use crate::dbs::Response; use crate::dbs::Transaction; use crate::err::Error; use crate::sql::array::{array, Array}; @@ -50,7 +49,6 @@ use std::cmp::Ordering; use std::collections::BTreeMap; use std::collections::HashMap; use std::fmt::{self, Display, Formatter}; -use std::iter::FromIterator; use std::ops; use std::ops::Deref; use std::str::FromStr; @@ -466,16 +464,6 @@ impl From for Value { } } -impl FromIterator for Vec { - fn from_iter>(iter: I) -> Self { - let mut c: Vec = vec![]; - for i in iter { - c.push(i.into()) - } - c - } -} - impl Value { // ----------------------------------- // Initial record value