qdrant_client/builders/
uuid_index_params_builder.rs1use crate::qdrant::*;
2
3#[must_use]
4#[derive(Clone)]
5pub struct UuidIndexParamsBuilder {
6 pub(crate) is_tenant: Option<Option<bool>>,
8 pub(crate) on_disk: Option<Option<bool>>,
10 pub(crate) enable_hnsw: Option<Option<bool>>,
12 pub(crate) memory: Option<Option<i32>>,
14}
15
16impl UuidIndexParamsBuilder {
17 pub fn is_tenant(self, value: bool) -> Self {
19 let mut new = self;
20 new.is_tenant = Option::Some(Option::Some(value));
21 new
22 }
23 pub fn on_disk(self, value: bool) -> Self {
27 let mut new = self;
28 new.on_disk = Option::Some(Option::Some(value));
29 new
30 }
31 pub fn enable_hnsw(self, value: bool) -> Self {
33 let mut new = self;
34 new.enable_hnsw = Option::Some(Option::Some(value));
35 new
36 }
37 pub fn memory<VALUE: core::convert::Into<i32>>(self, value: VALUE) -> Self {
40 let mut new = self;
41 new.memory = Option::Some(Option::Some(value.into()));
42 new
43 }
44
45 #[allow(deprecated)]
46 fn build_inner(self) -> Result<UuidIndexParams, std::convert::Infallible> {
47 Ok(UuidIndexParams {
48 is_tenant: self.is_tenant.unwrap_or_default(),
49 on_disk: self.on_disk.unwrap_or_default(),
50 enable_hnsw: self.enable_hnsw.unwrap_or_default(),
51 memory: self.memory.unwrap_or_default(),
52 })
53 }
54 fn create_empty() -> Self {
56 Self {
57 is_tenant: core::default::Default::default(),
58 on_disk: core::default::Default::default(),
59 enable_hnsw: core::default::Default::default(),
60 memory: core::default::Default::default(),
61 }
62 }
63}
64
65impl Default for UuidIndexParamsBuilder {
66 fn default() -> Self {
67 Self::create_empty()
68 }
69}
70
71impl From<UuidIndexParamsBuilder> for UuidIndexParams {
72 fn from(value: UuidIndexParamsBuilder) -> Self {
73 value.build_inner().unwrap_or_else(|_| {
74 panic!(
75 "Failed to convert {0} to {1}",
76 "UuidIndexParamsBuilder", "UuidIndexParams"
77 )
78 })
79 }
80}
81
82impl UuidIndexParamsBuilder {
83 pub fn build(self) -> UuidIndexParams {
85 self.build_inner().unwrap_or_else(|_| {
86 panic!(
87 "Failed to build {0} into {1}",
88 "UuidIndexParamsBuilder", "UuidIndexParams"
89 )
90 })
91 }
92}