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