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