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