qdrant_client/builders/
quantization_search_params_builder.rs1use crate::qdrant::*;
2
3pub struct QuantizationSearchParamsBuilder {
4 pub(crate) ignore: Option<Option<bool>>,
7 pub(crate) rescore: Option<Option<bool>>,
10 pub(crate) oversampling: Option<Option<f64>>,
19}
20
21impl QuantizationSearchParamsBuilder {
22 #[allow(unused_mut)]
25 pub fn ignore(self, value: bool) -> Self {
26 let mut new = self;
27 new.ignore = Option::Some(Option::Some(value));
28 new
29 }
30 #[allow(unused_mut)]
33 pub fn rescore(self, value: bool) -> Self {
34 let mut new = self;
35 new.rescore = Option::Some(Option::Some(value));
36 new
37 }
38 #[allow(unused_mut)]
47 pub fn oversampling(self, value: f64) -> Self {
48 let mut new = self;
49 new.oversampling = Option::Some(Option::Some(value));
50 new
51 }
52
53 fn build_inner(self) -> Result<QuantizationSearchParams, std::convert::Infallible> {
54 Ok(QuantizationSearchParams {
55 ignore: self.ignore.unwrap_or_default(),
56 rescore: self.rescore.unwrap_or_default(),
57 oversampling: self.oversampling.unwrap_or_default(),
58 })
59 }
60 fn create_empty() -> Self {
62 Self {
63 ignore: core::default::Default::default(),
64 rescore: core::default::Default::default(),
65 oversampling: core::default::Default::default(),
66 }
67 }
68}
69
70impl Default for QuantizationSearchParamsBuilder {
71 fn default() -> Self {
72 Self::create_empty()
73 }
74}
75
76impl From<QuantizationSearchParamsBuilder> for QuantizationSearchParams {
77 fn from(value: QuantizationSearchParamsBuilder) -> Self {
78 value.build_inner().unwrap_or_else(|_| {
79 panic!(
80 "Failed to convert {0} to {1}",
81 "QuantizationSearchParamsBuilder", "QuantizationSearchParams"
82 )
83 })
84 }
85}
86
87impl QuantizationSearchParamsBuilder {
88 pub fn build(self) -> QuantizationSearchParams {
90 self.build_inner().unwrap_or_else(|_| {
91 panic!(
92 "Failed to build {0} into {1}",
93 "QuantizationSearchParamsBuilder", "QuantizationSearchParams"
94 )
95 })
96 }
97}