qdrant_client/builders/
keyword_index_params_builder.rs1use crate::qdrant::*;
2
3#[derive(Clone)]
4pub struct KeywordIndexParamsBuilder {
5 pub(crate) is_tenant: Option<Option<bool>>,
7 pub(crate) on_disk: Option<Option<bool>>,
9}
10
11impl Default for KeywordIndexParamsBuilder {
12 fn default() -> Self {
13 Self::create_empty()
14 }
15}
16
17impl KeywordIndexParamsBuilder {
18 pub fn is_tenant(self, value: bool) -> Self {
20 let mut new = self;
21 new.is_tenant = Option::Some(Option::Some(value));
22 new
23 }
24 pub fn on_disk(self, value: bool) -> Self {
26 let mut new = self;
27 new.on_disk = Option::Some(Option::Some(value));
28 new
29 }
30
31 fn build_inner(self) -> Result<KeywordIndexParams, std::convert::Infallible> {
32 Ok(KeywordIndexParams {
33 is_tenant: self.is_tenant.unwrap_or_default(),
34 on_disk: self.on_disk.unwrap_or_default(),
35 })
36 }
37 fn create_empty() -> Self {
39 Self {
40 is_tenant: core::default::Default::default(),
41 on_disk: core::default::Default::default(),
42 }
43 }
44}
45
46impl From<KeywordIndexParamsBuilder> for KeywordIndexParams {
47 fn from(value: KeywordIndexParamsBuilder) -> Self {
48 value.build_inner().unwrap_or_else(|_| {
49 panic!(
50 "Failed to convert {0} to {1}",
51 "KeywordIndexParamsBuilder", "KeywordIndexParams"
52 )
53 })
54 }
55}
56
57impl KeywordIndexParamsBuilder {
58 pub fn build(self) -> KeywordIndexParams {
60 self.build_inner().unwrap_or_else(|_| {
61 panic!(
62 "Failed to build {0} into {1}",
63 "KeywordIndexParamsBuilder", "KeywordIndexParams"
64 )
65 })
66 }
67}