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