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