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    pub fn on_disk(self, value: bool) -> Self {
22        let mut new = self;
23        new.on_disk = Option::Some(Option::Some(value));
24        new
25    }
26
27    fn build_inner(self) -> Result<BoolIndexParams, std::convert::Infallible> {
28        Ok(BoolIndexParams {
29            on_disk: self.on_disk.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        }
37    }
38}
39
40impl From<BoolIndexParamsBuilder> for BoolIndexParams {
41    fn from(value: BoolIndexParamsBuilder) -> Self {
42        value.build_inner().unwrap_or_else(|_| {
43            panic!(
44                "Failed to convert {0} to {1}",
45                "BoolIndexParamsBuilder", "BoolIndexParams"
46            )
47        })
48    }
49}
50
51impl BoolIndexParamsBuilder {
52    /// Builds the desired type. Can often be omitted.
53    pub fn build(self) -> BoolIndexParams {
54        self.build_inner().unwrap_or_else(|_| {
55            panic!(
56                "Failed to build {0} into {1}",
57                "BoolIndexParamsBuilder", "BoolIndexParams"
58            )
59        })
60    }
61}