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}
13
14impl DatetimeIndexParamsBuilder {
15 pub fn on_disk(self, value: bool) -> Self {
17 let mut new = self;
18 new.on_disk = Option::Some(Option::Some(value));
19 new
20 }
21 pub fn is_principal(self, value: bool) -> Self {
23 let mut new = self;
24 new.is_principal = Option::Some(Option::Some(value));
25 new
26 }
27 pub fn enable_hnsw(self, value: bool) -> Self {
29 let mut new = self;
30 new.enable_hnsw = Option::Some(Option::Some(value));
31 new
32 }
33
34 fn build_inner(self) -> Result<DatetimeIndexParams, std::convert::Infallible> {
35 Ok(DatetimeIndexParams {
36 on_disk: self.on_disk.unwrap_or_default(),
37 is_principal: self.is_principal.unwrap_or_default(),
38 enable_hnsw: self.enable_hnsw.unwrap_or_default(),
39 })
40 }
41 fn create_empty() -> Self {
43 Self {
44 on_disk: core::default::Default::default(),
45 is_principal: core::default::Default::default(),
46 enable_hnsw: core::default::Default::default(),
47 }
48 }
49}
50
51impl Default for DatetimeIndexParamsBuilder {
52 fn default() -> Self {
53 Self::create_empty()
54 }
55}
56
57impl From<DatetimeIndexParamsBuilder> for DatetimeIndexParams {
58 fn from(value: DatetimeIndexParamsBuilder) -> Self {
59 value.build_inner().unwrap_or_else(|_| {
60 panic!(
61 "Failed to convert {0} to {1}",
62 "DatetimeIndexParamsBuilder", "DatetimeIndexParams"
63 )
64 })
65 }
66}
67
68impl DatetimeIndexParamsBuilder {
69 pub fn build(self) -> DatetimeIndexParams {
71 self.build_inner().unwrap_or_else(|_| {
72 panic!(
73 "Failed to build {0} into {1}",
74 "DatetimeIndexParamsBuilder", "DatetimeIndexParams"
75 )
76 })
77 }
78}