qdrant_client/builders/
sparse_index_config_builder.rs1use crate::qdrant::*;
2
3pub struct SparseIndexConfigBuilder {
4 pub(crate) full_scan_threshold: Option<Option<u64>>,
8 pub(crate) on_disk: Option<Option<bool>>,
11 pub(crate) datatype: Option<Option<i32>>,
14}
15
16impl SparseIndexConfigBuilder {
17 #[allow(unused_mut)]
21 pub fn full_scan_threshold<VALUE: core::convert::Into<u64>>(self, value: VALUE) -> Self {
22 let mut new = self;
23 new.full_scan_threshold = Option::Some(Option::Some(value.into()));
24 new
25 }
26 #[allow(unused_mut)]
29 pub fn on_disk(self, value: bool) -> Self {
30 let mut new = self;
31 new.on_disk = Option::Some(Option::Some(value));
32 new
33 }
34 #[allow(unused_mut)]
37 pub fn datatype<VALUE: core::convert::Into<i32>>(self, value: VALUE) -> Self {
38 let mut new = self;
39 new.datatype = Option::Some(Option::Some(value.into()));
40 new
41 }
42
43 fn build_inner(self) -> Result<SparseIndexConfig, std::convert::Infallible> {
44 Ok(SparseIndexConfig {
45 full_scan_threshold: self.full_scan_threshold.unwrap_or_default(),
46 on_disk: self.on_disk.unwrap_or_default(),
47 datatype: self.datatype.unwrap_or_default(),
48 })
49 }
50 fn create_empty() -> Self {
52 Self {
53 full_scan_threshold: core::default::Default::default(),
54 on_disk: core::default::Default::default(),
55 datatype: core::default::Default::default(),
56 }
57 }
58}
59
60impl From<SparseIndexConfigBuilder> for SparseIndexConfig {
61 fn from(value: SparseIndexConfigBuilder) -> Self {
62 value.build_inner().unwrap_or_else(|_| {
63 panic!(
64 "Failed to convert {0} to {1}",
65 "SparseIndexConfigBuilder", "SparseIndexConfig"
66 )
67 })
68 }
69}
70
71impl SparseIndexConfigBuilder {
72 pub fn build(self) -> SparseIndexConfig {
74 self.build_inner().unwrap_or_else(|_| {
75 panic!(
76 "Failed to build {0} into {1}",
77 "SparseIndexConfigBuilder", "SparseIndexConfig"
78 )
79 })
80 }
81}
82
83impl Default for SparseIndexConfigBuilder {
84 fn default() -> Self {
85 Self::create_empty()
86 }
87}