qdrant_client/builders/
delete_field_index_collection_builder.rsuse crate::qdrant::*;
pub struct DeleteFieldIndexCollectionBuilder {
pub(crate) collection_name: Option<String>,
pub(crate) wait: Option<Option<bool>>,
pub(crate) field_name: Option<String>,
pub(crate) ordering: Option<Option<WriteOrdering>>,
}
impl DeleteFieldIndexCollectionBuilder {
#[allow(unused_mut)]
pub fn collection_name(self, value: String) -> Self {
let mut new = self;
new.collection_name = Option::Some(value);
new
}
#[allow(unused_mut)]
pub fn wait(self, value: bool) -> Self {
let mut new = self;
new.wait = Option::Some(Option::Some(value));
new
}
#[allow(unused_mut)]
pub fn field_name(self, value: String) -> Self {
let mut new = self;
new.field_name = Option::Some(value);
new
}
#[allow(unused_mut)]
pub fn ordering(self, value: WriteOrdering) -> Self {
let mut new = self;
new.ordering = Option::Some(Option::Some(value));
new
}
fn build_inner(
self,
) -> Result<DeleteFieldIndexCollection, DeleteFieldIndexCollectionBuilderError> {
Ok(DeleteFieldIndexCollection {
collection_name: match self.collection_name {
Some(value) => value,
None => {
return Result::Err(core::convert::Into::into(
::derive_builder::UninitializedFieldError::from("collection_name"),
));
}
},
wait: self.wait.unwrap_or_default(),
field_name: match self.field_name {
Some(value) => value,
None => {
return Result::Err(core::convert::Into::into(
::derive_builder::UninitializedFieldError::from("field_name"),
));
}
},
ordering: self.ordering.unwrap_or_default(),
})
}
fn create_empty() -> Self {
Self {
collection_name: core::default::Default::default(),
wait: core::default::Default::default(),
field_name: core::default::Default::default(),
ordering: core::default::Default::default(),
}
}
}
impl From<DeleteFieldIndexCollectionBuilder> for DeleteFieldIndexCollection {
fn from(value: DeleteFieldIndexCollectionBuilder) -> Self {
value.build_inner().unwrap_or_else(|_| {
panic!(
"Failed to convert {0} to {1}",
"DeleteFieldIndexCollectionBuilder", "DeleteFieldIndexCollection"
)
})
}
}
impl DeleteFieldIndexCollectionBuilder {
pub fn build(self) -> DeleteFieldIndexCollection {
self.build_inner().unwrap_or_else(|_| {
panic!(
"Failed to build {0} into {1}",
"DeleteFieldIndexCollectionBuilder", "DeleteFieldIndexCollection"
)
})
}
}
impl DeleteFieldIndexCollectionBuilder {
pub(crate) fn empty() -> Self {
Self::create_empty()
}
}
#[non_exhaustive]
#[derive(Debug)]
pub enum DeleteFieldIndexCollectionBuilderError {
UninitializedField(&'static str),
ValidationError(String),
}
impl std::fmt::Display for DeleteFieldIndexCollectionBuilderError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
Self::UninitializedField(field) => {
write!(f, "`{}` must be initialized", field)
}
Self::ValidationError(error) => write!(f, "{}", error),
}
}
}
impl std::error::Error for DeleteFieldIndexCollectionBuilderError {}
impl From<derive_builder::UninitializedFieldError> for DeleteFieldIndexCollectionBuilderError {
fn from(error: derive_builder::UninitializedFieldError) -> Self {
Self::UninitializedField(error.field_name())
}
}
impl From<String> for DeleteFieldIndexCollectionBuilderError {
fn from(error: String) -> Self {
Self::ValidationError(error)
}
}