qdrant_client/builders/
bool_index_params_builder.rs

1use crate::qdrant::*;
2
3#[derive(Clone)]
4pub struct BoolIndexParamsBuilder {
5    /// If true - store index on disk.
6    pub(crate) on_disk: Option<Option<bool>>,
7}
8
9impl Default for BoolIndexParamsBuilder {
10    fn default() -> Self {
11        Self::new()
12    }
13}
14
15impl BoolIndexParamsBuilder {
16    pub fn new() -> Self {
17        Self::create_empty()
18    }
19
20    /// If true - store index on disk.
21    #[allow(unused_mut)]
22    pub fn on_disk(self, value: bool) -> Self {
23        let mut new = self;
24        new.on_disk = Option::Some(Option::Some(value));
25        new
26    }
27
28    fn build_inner(self) -> Result<BoolIndexParams, std::convert::Infallible> {
29        Ok(BoolIndexParams {
30            on_disk: self.on_disk.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        }
38    }
39}
40
41impl From<BoolIndexParamsBuilder> for BoolIndexParams {
42    fn from(value: BoolIndexParamsBuilder) -> Self {
43        value.build_inner().unwrap_or_else(|_| {
44            panic!(
45                "Failed to convert {0} to {1}",
46                "BoolIndexParamsBuilder", "BoolIndexParams"
47            )
48        })
49    }
50}
51
52impl BoolIndexParamsBuilder {
53    /// Builds the desired type. Can often be omitted.
54    pub fn build(self) -> BoolIndexParams {
55        self.build_inner().unwrap_or_else(|_| {
56            panic!(
57                "Failed to build {0} into {1}",
58                "BoolIndexParamsBuilder", "BoolIndexParams"
59            )
60        })
61    }
62}