qdrant_client/builders/
uuid_index_params_builder.rs1use crate::qdrant::*;
2
3#[derive(Clone)]
4pub struct UuidIndexParamsBuilder {
5 pub(crate) is_tenant: Option<Option<bool>>,
7 pub(crate) on_disk: Option<Option<bool>>,
9 pub(crate) enable_hnsw: Option<Option<bool>>,
11}
12
13impl UuidIndexParamsBuilder {
14 pub fn is_tenant(self, value: bool) -> Self {
16 let mut new = self;
17 new.is_tenant = Option::Some(Option::Some(value));
18 new
19 }
20 pub fn on_disk(self, value: bool) -> Self {
22 let mut new = self;
23 new.on_disk = Option::Some(Option::Some(value));
24 new
25 }
26 pub fn enable_hnsw(self, value: bool) -> Self {
28 let mut new = self;
29 new.enable_hnsw = Option::Some(Option::Some(value));
30 new
31 }
32
33 fn build_inner(self) -> Result<UuidIndexParams, std::convert::Infallible> {
34 Ok(UuidIndexParams {
35 is_tenant: self.is_tenant.unwrap_or_default(),
36 on_disk: self.on_disk.unwrap_or_default(),
37 enable_hnsw: self.enable_hnsw.unwrap_or_default(),
38 })
39 }
40 fn create_empty() -> Self {
42 Self {
43 is_tenant: core::default::Default::default(),
44 on_disk: core::default::Default::default(),
45 enable_hnsw: core::default::Default::default(),
46 }
47 }
48}
49
50impl Default for UuidIndexParamsBuilder {
51 fn default() -> Self {
52 Self::create_empty()
53 }
54}
55
56impl From<UuidIndexParamsBuilder> for UuidIndexParams {
57 fn from(value: UuidIndexParamsBuilder) -> Self {
58 value.build_inner().unwrap_or_else(|_| {
59 panic!(
60 "Failed to convert {0} to {1}",
61 "UuidIndexParamsBuilder", "UuidIndexParams"
62 )
63 })
64 }
65}
66
67impl UuidIndexParamsBuilder {
68 pub fn build(self) -> UuidIndexParams {
70 self.build_inner().unwrap_or_else(|_| {
71 panic!(
72 "Failed to build {0} into {1}",
73 "UuidIndexParamsBuilder", "UuidIndexParams"
74 )
75 })
76 }
77}