qdrant_client/builders/
datetime_index_params_builder.rs

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