qdrant_client/builders/
sparse_index_config_builder.rsuse crate::qdrant::*;
pub struct SparseIndexConfigBuilder {
pub(crate) full_scan_threshold: Option<Option<u64>>,
pub(crate) on_disk: Option<Option<bool>>,
pub(crate) datatype: Option<Option<i32>>,
}
impl SparseIndexConfigBuilder {
#[allow(unused_mut)]
pub fn full_scan_threshold<VALUE: core::convert::Into<u64>>(self, value: VALUE) -> Self {
let mut new = self;
new.full_scan_threshold = Option::Some(Option::Some(value.into()));
new
}
#[allow(unused_mut)]
pub fn on_disk(self, value: bool) -> Self {
let mut new = self;
new.on_disk = Option::Some(Option::Some(value));
new
}
#[allow(unused_mut)]
pub fn datatype<VALUE: core::convert::Into<i32>>(self, value: VALUE) -> Self {
let mut new = self;
new.datatype = Option::Some(Option::Some(value.into()));
new
}
fn build_inner(self) -> Result<SparseIndexConfig, std::convert::Infallible> {
Ok(SparseIndexConfig {
full_scan_threshold: self.full_scan_threshold.unwrap_or_default(),
on_disk: self.on_disk.unwrap_or_default(),
datatype: self.datatype.unwrap_or_default(),
})
}
fn create_empty() -> Self {
Self {
full_scan_threshold: core::default::Default::default(),
on_disk: core::default::Default::default(),
datatype: core::default::Default::default(),
}
}
}
impl From<SparseIndexConfigBuilder> for SparseIndexConfig {
fn from(value: SparseIndexConfigBuilder) -> Self {
value.build_inner().unwrap_or_else(|_| {
panic!(
"Failed to convert {0} to {1}",
"SparseIndexConfigBuilder", "SparseIndexConfig"
)
})
}
}
impl SparseIndexConfigBuilder {
pub fn build(self) -> SparseIndexConfig {
self.build_inner().unwrap_or_else(|_| {
panic!(
"Failed to build {0} into {1}",
"SparseIndexConfigBuilder", "SparseIndexConfig"
)
})
}
}
impl Default for SparseIndexConfigBuilder {
fn default() -> Self {
Self::create_empty()
}
}