qdrant_client/builders/
datetime_index_params_builder.rs1use crate::qdrant::*;
2
3#[must_use]
4#[derive(Clone)]
5pub struct DatetimeIndexParamsBuilder {
6 pub(crate) on_disk: Option<Option<bool>>,
8 pub(crate) is_principal: Option<Option<bool>>,
10 pub(crate) enable_hnsw: Option<Option<bool>>,
12 pub(crate) memory: Option<Option<i32>>,
14 pub(crate) nested: Option<Option<String>>,
16}
17
18impl DatetimeIndexParamsBuilder {
19 pub fn on_disk(self, value: bool) -> Self {
23 let mut new = self;
24 new.on_disk = Option::Some(Option::Some(value));
25 new
26 }
27 pub fn is_principal(self, value: bool) -> Self {
29 let mut new = self;
30 new.is_principal = Option::Some(Option::Some(value));
31 new
32 }
33 pub fn enable_hnsw(self, value: bool) -> Self {
35 let mut new = self;
36 new.enable_hnsw = Option::Some(Option::Some(value));
37 new
38 }
39 pub fn memory<VALUE: core::convert::Into<i32>>(self, value: VALUE) -> Self {
42 let mut new = self;
43 new.memory = Option::Some(Option::Some(value.into()));
44 new
45 }
46 pub fn nested(self, value: impl Into<String>) -> Self {
49 let mut new = self;
50 new.nested = Option::Some(Option::Some(value.into()));
51 new
52 }
53
54 #[allow(deprecated)]
55 fn build_inner(self) -> Result<DatetimeIndexParams, std::convert::Infallible> {
56 Ok(DatetimeIndexParams {
57 on_disk: self.on_disk.unwrap_or_default(),
58 is_principal: self.is_principal.unwrap_or_default(),
59 enable_hnsw: self.enable_hnsw.unwrap_or_default(),
60 memory: self.memory.unwrap_or_default(),
61 nested: self.nested.unwrap_or_default(),
62 })
63 }
64 fn create_empty() -> Self {
66 Self {
67 on_disk: core::default::Default::default(),
68 is_principal: core::default::Default::default(),
69 enable_hnsw: core::default::Default::default(),
70 memory: core::default::Default::default(),
71 nested: core::default::Default::default(),
72 }
73 }
74}
75
76impl Default for DatetimeIndexParamsBuilder {
77 fn default() -> Self {
78 Self::create_empty()
79 }
80}
81
82impl From<DatetimeIndexParamsBuilder> for DatetimeIndexParams {
83 fn from(value: DatetimeIndexParamsBuilder) -> Self {
84 value.build_inner().unwrap_or_else(|_| {
85 panic!(
86 "Failed to convert {0} to {1}",
87 "DatetimeIndexParamsBuilder", "DatetimeIndexParams"
88 )
89 })
90 }
91}
92
93impl DatetimeIndexParamsBuilder {
94 pub fn build(self) -> DatetimeIndexParams {
96 self.build_inner().unwrap_or_else(|_| {
97 panic!(
98 "Failed to build {0} into {1}",
99 "DatetimeIndexParamsBuilder", "DatetimeIndexParams"
100 )
101 })
102 }
103}