Remove unused Response to Value conversion implementation

This commit is contained in:
Tobie Morgan Hitchcock 2022-10-25 06:05:02 -07:00
parent 8f873cae5c
commit 2e1d39fcf8
2 changed files with 0 additions and 35 deletions

View file

@ -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<Response> 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<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where

View file

@ -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<Id> for Value {
}
}
impl FromIterator<Response> for Vec<Value> {
fn from_iter<I: IntoIterator<Item = Response>>(iter: I) -> Self {
let mut c: Vec<Value> = vec![];
for i in iter {
c.push(i.into())
}
c
}
}
impl Value {
// -----------------------------------
// Initial record value