qdrant_client/builders/
datetime_index_params_builder.rs

1use crate::qdrant::*;
2
3pub struct DatetimeIndexParamsBuilder {
4    /// If true - store index on disk.
5    pub(crate) on_disk: Option<Option<bool>>,
6    /// If true - use this key to organize storage of the collection data. This option assumes that this key will be used in majority of filtered requests.
7    pub(crate) is_principal: Option<Option<bool>>,
8}
9
10impl DatetimeIndexParamsBuilder {
11    /// If true - store index on disk.
12    #[allow(unused_mut)]
13    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    /// If true - use this key to organize storage of the collection data. This option assumes that this key will be used in majority of filtered requests.
19    #[allow(unused_mut)]
20    pub fn is_principal(self, value: bool) -> Self {
21        let mut new = self;
22        new.is_principal = Option::Some(Option::Some(value));
23        new
24    }
25
26    fn build_inner(self) -> Result<DatetimeIndexParams, std::convert::Infallible> {
27        Ok(DatetimeIndexParams {
28            on_disk: self.on_disk.unwrap_or_default(),
29            is_principal: self.is_principal.unwrap_or_default(),
30        })
31    }
32    /// Create an empty builder, with all fields set to `None` or `PhantomData`.
33    fn create_empty() -> Self {
34        Self {
35            on_disk: core::default::Default::default(),
36            is_principal: core::default::Default::default(),
37        }
38    }
39}
40
41impl Default for DatetimeIndexParamsBuilder {
42    fn default() -> Self {
43        Self::create_empty()
44    }
45}
46
47impl From<DatetimeIndexParamsBuilder> for DatetimeIndexParams {
48    fn from(value: DatetimeIndexParamsBuilder) -> Self {
49        value.build_inner().unwrap_or_else(|_| {
50            panic!(
51                "Failed to convert {0} to {1}",
52                "DatetimeIndexParamsBuilder", "DatetimeIndexParams"
53            )
54        })
55    }
56}
57
58impl DatetimeIndexParamsBuilder {
59    /// Builds the desired type. Can often be omitted.
60    pub fn build(self) -> DatetimeIndexParams {
61        self.build_inner().unwrap_or_else(|_| {
62            panic!(
63                "Failed to build {0} into {1}",
64                "DatetimeIndexParamsBuilder", "DatetimeIndexParams"
65            )
66        })
67    }
68}