qdrant_client::qdrant

Struct Value

source
pub struct Value {
    pub kind: Option<Kind>,
}
Expand description

Value represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. A producer of value is expected to set one of those variants, absence of any variant indicates an error.

The JSON representation for Value is a JSON value.

Fields§

§kind: Option<Kind>

The kind of value.

Implementations§

source§

impl Value

source

pub fn is_null(&self) -> bool

Check if this value is a NullValue

source

pub fn is_bool(&self) -> bool

Check if this value is a BoolValue

source

pub fn as_bool(&self) -> Option<bool>

Get this value as bool

Returns None if this value is not a BoolValue.

source

pub fn is_integer(&self) -> bool

Check if this value is a IntegerValue

source

pub fn as_integer(&self) -> Option<i64>

Get this value as i64

Returns None if this value is not a IntegerValue.

source

pub fn is_double(&self) -> bool

Check if this value is a DoubleValue

source

pub fn as_double(&self) -> Option<f64>

Get this value as f64

Returns None if this value is not a DoubleValue.

source

pub fn is_str(&self) -> bool

Check if this value is a StringValue

source

pub fn as_str(&self) -> Option<&String>

Get this value as String

Returns None if this value is not a StringValue.

source

pub fn is_list(&self) -> bool

Check if this value is a ListValue

source

pub fn as_list(&self) -> Option<&[Value]>

Get this value as [Value]

Returns None if this value is not a ListValue.

source

pub fn is_struct(&self) -> bool

Check if this value is a StructValue

source

pub fn as_struct(&self) -> Option<&Struct>

Get this value as Struct

Returns None if this value is not a StructValue.

source§

impl Value

source

pub fn into_json(self) -> Value

Convert this into a serde_json::Value

§Examples:
use serde_json::json;
use qdrant_client::prelude::*;
use qdrant_client::qdrant::{value::Kind::*, Struct};
let value = Value { kind: Some(StructValue(Struct {
    fields: [
        ("text".into(), Value { kind: Some(StringValue("Hi Qdrant!".into())) }),
        ("int".into(), Value { kind: Some(IntegerValue(42))}),
    ].into()
}))};
assert_eq!(value.into_json(), json!({
   "text": "Hi Qdrant!",
   "int": 42
}));
source§

impl Value

source

pub fn try_list_iter(&self) -> Option<impl Iterator<Item = &Value>>

Try to get an iterator over the items of the contained list value

Returns None if this is not a list.

source

pub fn iter_list(&self) -> Result<impl Iterator<Item = &Value>, NotA<ListValue>>

👎Deprecated since 1.10.0: use try_list_iter instead

Try to get an iterator over the items of the contained list value, if any

source

pub fn get_value(&self, key: &str) -> Option<&Value>

Get a value from a struct field

Returns None if this is not a struct type or if the field is not present.

source

pub fn get_struct(&self, key: &str) -> Result<&Value, NotA<Struct>>

👎Deprecated since 1.10.0: use get_value instead

Try to get a field from the struct if this value contains one

Trait Implementations§

source§

impl Clone for Value

source§

fn clone(&self) -> Value

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Value

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Value

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Value

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Value

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&str> for Value

source§

fn from(val: &str) -> Self

Converts to this type from the input type.
source§

impl From<Kind> for Value

source§

fn from(value: Kind) -> Self

Converts to this type from the input type.
source§

impl From<Payload> for Value

source§

fn from(val: Payload) -> Self

Converts to this type from the input type.
source§

impl From<String> for Value

source§

fn from(val: String) -> Self

Converts to this type from the input type.
source§

impl From<Value> for Value

source§

fn from(value: Value) -> Self

Converts to this type from the input type.
source§

impl From<Value> for Value

source§

fn from(value: Value) -> Self

Converts to this type from the input type.
source§

impl<T> From<Vec<(&str, T)>> for Value
where T: Into<Value>,

source§

fn from(val: Vec<(&str, T)>) -> Self

Converts to this type from the input type.
source§

impl<T> From<Vec<T>> for Value
where T: Into<Value>,

source§

fn from(val: Vec<T>) -> Self

Converts to this type from the input type.
source§

impl From<bool> for Value

source§

fn from(val: bool) -> Self

Converts to this type from the input type.
source§

impl From<f32> for Value

source§

fn from(val: f32) -> Self

Converts to this type from the input type.
source§

impl From<f64> for Value

source§

fn from(val: f64) -> Self

Converts to this type from the input type.
source§

impl From<i64> for Value

source§

fn from(val: i64) -> Self

Converts to this type from the input type.
source§

impl Message for Value

source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
source§

impl PartialEq for Value

source§

fn eq(&self, other: &Value) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Value

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<Value> for String

source§

type Error = NotA<String>

The type returned in the event of a conversion error.
source§

fn try_from(v: Value) -> Result<Self, NotA<String>>

Performs the conversion.
source§

impl TryFrom<Value> for bool

source§

type Error = NotA<bool>

The type returned in the event of a conversion error.
source§

fn try_from(v: Value) -> Result<Self, NotA<bool>>

Performs the conversion.
source§

impl TryFrom<Value> for f64

source§

type Error = NotA<f64>

The type returned in the event of a conversion error.
source§

fn try_from(v: Value) -> Result<Self, NotA<f64>>

Performs the conversion.
source§

impl TryFrom<Value> for i64

source§

type Error = NotA<i64>

The type returned in the event of a conversion error.
source§

fn try_from(v: Value) -> Result<Self, NotA<i64>>

Performs the conversion.
source§

impl StructuralPartialEq for Value

Auto Trait Implementations§

§

impl Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnwindSafe for Value

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit #126799)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromRef<T> for T
where T: Clone,

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,