qdrant_client/builders/
payload_storage_params_builder.rs1use crate::qdrant::*;
2
3#[must_use]
4#[derive(Clone)]
5pub struct PayloadStorageParamsBuilder {
6 pub(crate) memory: Option<Option<i32>>,
8}
9
10impl Default for PayloadStorageParamsBuilder {
11 fn default() -> Self {
12 Self::new()
13 }
14}
15
16impl PayloadStorageParamsBuilder {
17 pub fn new() -> Self {
18 Self::create_empty()
19 }
20
21 pub fn memory<VALUE: core::convert::Into<i32>>(self, value: VALUE) -> Self {
25 let mut new = self;
26 new.memory = Option::Some(Option::Some(value.into()));
27 new
28 }
29
30 fn build_inner(self) -> Result<PayloadStorageParams, std::convert::Infallible> {
31 Ok(PayloadStorageParams {
32 memory: self.memory.unwrap_or_default(),
33 })
34 }
35 fn create_empty() -> Self {
37 Self {
38 memory: core::default::Default::default(),
39 }
40 }
41}
42
43impl From<PayloadStorageParamsBuilder> for PayloadStorageParams {
44 fn from(value: PayloadStorageParamsBuilder) -> Self {
45 value.build_inner().unwrap_or_else(|_| {
46 panic!(
47 "Failed to convert {0} to {1}",
48 "PayloadStorageParamsBuilder", "PayloadStorageParams"
49 )
50 })
51 }
52}
53
54impl PayloadStorageParamsBuilder {
55 pub fn build(self) -> PayloadStorageParams {
57 self.build_inner().unwrap_or_else(|_| {
58 panic!(
59 "Failed to build {0} into {1}",
60 "PayloadStorageParamsBuilder", "PayloadStorageParams"
61 )
62 })
63 }
64}