qdrant_client

Struct Payload

source
pub struct Payload(/* private fields */);
Expand description

Point payload

A JSON-like object that can be attached to points. With payloads you can store any kind of information along with your points. Qdrant provides comprehensive ways to filter on payload values during vector search.

Payload documentation: https://qdrant.tech/documentation/concepts/payload/

§Serde

Requires serde feature

Serde JSON types can be converted to and from Payload. Note that a valid payload must be a JSON object, and not another JSON type.

Convert a JSON Value to and from Payload:

use serde_json::{Value, json};

let value = json!({
    "city": "Berlin",
});

let payload = Payload::try_from(value).expect("not a JSON object");
let value = Value::from(payload);

If the above value is not a JSON object, a QdrantError::JsonToPayload error is returned.

Convert a JSON object (Map<String, Value>) to and from from Payload:

use serde_json::{Map, Value};

let mut object = Map::new();
object.insert("city".to_string(), "Berlin".into());

let payload = Payload::from(object);
let object = Map::from(payload);

Implementations§

source§

impl Payload

source

pub fn new() -> Self

Construct a new empty payload object

source

pub fn new_from_hashmap(payload: HashMap<String, Value>) -> Self

👎Deprecated since 1.10.0: use Payload::from instead

Construct a payload object from the given hash map

source

pub fn insert(&mut self, key: impl ToString, val: impl Into<Value>)

Insert a payload value at the given key, replacing any existing value

Trait Implementations§

source§

impl Clone for Payload

source§

fn clone(&self) -> Payload

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 Payload

source§

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

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

impl Default for Payload

source§

fn default() -> Payload

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

impl<'de> Deserialize<'de> for Payload

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<K, const N: usize> From<[(K, Value); N]> for Payload
where K: Into<String>,

source§

fn from(values: [(K, Value); N]) -> Self

Converts to this type from the input type.
source§

impl From<HashMap<&str, Value>> for Payload

source§

fn from(payload: HashMap<&str, Value>) -> Self

Converts to this type from the input type.
source§

impl From<HashMap<String, Value>> for Payload

source§

fn from(payload: HashMap<String, Value>) -> Self

Converts to this type from the input type.
source§

impl From<Map<String, Value>> for Payload

source§

fn from(object: Map<String, Value>) -> Self

Convert JSON object into payload

If you have a JSON object as generic value of type Value, you can convert it with Payload::try_from.

source§

impl From<Payload> for HashMap<String, Value>

source§

fn from(payload: Payload) -> Self

Converts to this type from the input type.
source§

impl From<Payload> for Map<String, Value>

source§

fn from(value: Payload) -> Map<String, Value>

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<Payload> for Value

source§

fn from(value: Payload) -> Value

Converts to this type from the input type.
source§

impl PartialEq for Payload

source§

fn eq(&self, other: &Payload) -> 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 Payload

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 Payload

source§

fn try_from(value: Value) -> Result<Self, Self::Error>

Convert JSON object into payload

The JSON value must be a valid object. A JSON object of type Map<String, Value> can be converted without errors using Payload::from.

§Errors

Returns an QdrantError::JsonToPayload error if the value is not an object.

source§

type Error = QdrantError

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

impl StructuralPartialEq for Payload

Auto Trait Implementations§

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, 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>,