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}
15
16impl DatetimeIndexParamsBuilder {
17 pub fn on_disk(self, value: bool) -> Self {
21 let mut new = self;
22 new.on_disk = Option::Some(Option::Some(value));
23 new
24 }
25 pub fn is_principal(self, value: bool) -> Self {
27 let mut new = self;
28 new.is_principal = Option::Some(Option::Some(value));
29 new
30 }
31 pub fn enable_hnsw(self, value: bool) -> Self {
33 let mut new = self;
34 new.enable_hnsw = Option::Some(Option::Some(value));
35 new
36 }
37 pub fn memory<VALUE: core::convert::Into<i32>>(self, value: VALUE) -> Self {
40 let mut new = self;
41 new.memory = Option::Some(Option::Some(value.into()));
42 new
43 }
44
45 #[allow(deprecated)]
46 fn build_inner(self) -> Result<DatetimeIndexParams, std::convert::Infallible> {
47 Ok(DatetimeIndexParams {
48 on_disk: self.on_disk.unwrap_or_default(),
49 is_principal: self.is_principal.unwrap_or_default(),
50 enable_hnsw: self.enable_hnsw.unwrap_or_default(),
51 memory: self.memory.unwrap_or_default(),
52 })
53 }
54 fn create_empty() -> Self {
56 Self {
57 on_disk: core::default::Default::default(),
58 is_principal: core::default::Default::default(),
59 enable_hnsw: core::default::Default::default(),
60 memory: core::default::Default::default(),
61 }
62 }
63}
64
65impl Default for DatetimeIndexParamsBuilder {
66 fn default() -> Self {
67 Self::create_empty()
68 }
69}
70
71impl From<DatetimeIndexParamsBuilder> for DatetimeIndexParams {
72 fn from(value: DatetimeIndexParamsBuilder) -> Self {
73 value.build_inner().unwrap_or_else(|_| {
74 panic!(
75 "Failed to convert {0} to {1}",
76 "DatetimeIndexParamsBuilder", "DatetimeIndexParams"
77 )
78 })
79 }
80}
81
82impl DatetimeIndexParamsBuilder {
83 pub fn build(self) -> DatetimeIndexParams {
85 self.build_inner().unwrap_or_else(|_| {
86 panic!(
87 "Failed to build {0} into {1}",
88 "DatetimeIndexParamsBuilder", "DatetimeIndexParams"
89 )
90 })
91 }
92}