diff --git a/src/error.rs b/src/error.rs index e69a865..d3c4c64 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,11 +1,11 @@ -use crate::qdrant::value::Kind; +use crate::qdrant::value::Kind::*; use crate::qdrant::{ListValue, Struct, Value}; use std::error::Error; use std::fmt::{Debug, Display, Formatter}; use std::marker::PhantomData; /// An error for failed conversions (e.g. calling `String::try_from(v)` -/// on an integer [`Value`](crate::Value)) +/// on an integer [`Value`](Value)) pub struct NotA { marker: PhantomData, } @@ -64,7 +64,7 @@ impl TryFrom for bool { type Error = NotA; fn try_from(v: Value) -> Result> { - if let Some(Kind::BoolValue(t)) = v.kind { + if let Some(BoolValue(t)) = v.kind { Ok(t) } else { Err(NotA::default()) @@ -91,7 +91,7 @@ impl TryFrom for i64 { type Error = NotA; fn try_from(v: Value) -> Result> { - if let Some(Kind::IntegerValue(t)) = v.kind { + if let Some(IntegerValue(t)) = v.kind { Ok(t) } else { Err(NotA::default()) @@ -118,7 +118,7 @@ impl TryFrom for f64 { type Error = NotA; fn try_from(v: Value) -> Result> { - if let Some(Kind::DoubleValue(t)) = v.kind { + if let Some(DoubleValue(t)) = v.kind { Ok(t) } else { Err(NotA::default()) @@ -145,7 +145,7 @@ impl TryFrom for String { type Error = NotA; fn try_from(v: Value) -> Result> { - if let Some(Kind::StringValue(t)) = v.kind { + if let Some(StringValue(t)) = v.kind { Ok(t) } else { Err(NotA::default()) diff --git a/src/lib.rs b/src/lib.rs index 7e723f5..85ada48 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -120,8 +120,7 @@ pub mod serde; use error::NotA; use qdrant::{value::Kind::*, ListValue, RetrievedPoint, ScoredPoint, Struct, Value}; -use std::error::Error; -use std::fmt::{Debug, Display, Formatter}; +use std::fmt::{Display, Formatter}; use std::hash::{Hash, Hasher}; #[doc(no_inline)] @@ -152,8 +151,8 @@ impl ScoredPoint { /// /// # Examples: /// ``` - /// use qdrant_client::qdrant::ScrollPoints; - /// let point = ScrollPoints::default(); + /// use qdrant_client::qdrant::ScoredPoint; + /// let point = ScoredPoint::default(); /// assert!(point.get("not_present").is_null()); /// ```` pub fn get(&self, key: &str) -> &Value {