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
impl Value
sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Check if this value is a IntegerValue
sourcepub fn as_integer(&self) -> Option<i64>
pub fn as_integer(&self) -> Option<i64>
Get this value as i64
Returns None
if this value is not a
IntegerValue.
sourcepub fn is_double(&self) -> bool
pub fn is_double(&self) -> bool
Check if this value is a DoubleValue
sourcepub fn as_double(&self) -> Option<f64>
pub fn as_double(&self) -> Option<f64>
Get this value as f64
Returns None
if this value is not a
DoubleValue.
sourcepub fn is_str(&self) -> bool
pub fn is_str(&self) -> bool
Check if this value is a StringValue
sourcepub fn as_str(&self) -> Option<&String>
pub fn as_str(&self) -> Option<&String>
Get this value as String
Returns None
if this value is not a
StringValue.
sourcepub fn is_struct(&self) -> bool
pub fn is_struct(&self) -> bool
Check if this value is a StructValue
source§impl Value
impl Value
sourcepub fn into_json(self) -> Value
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
impl Value
sourcepub fn try_list_iter(&self) -> Option<impl Iterator<Item = &Value>>
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.
sourcepub fn iter_list(&self) -> Result<impl Iterator<Item = &Value>, NotA<ListValue>>
👎Deprecated since 1.10.0: use try_list_iter
instead
pub fn iter_list(&self) -> Result<impl Iterator<Item = &Value>, NotA<ListValue>>
try_list_iter
insteadTry to get an iterator over the items of the contained list value, if any
Trait Implementations§
source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
source§impl Message for Value
impl Message for Value
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moresource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request