qdrant_client/builders/
update_collection_cluster_setup_request_builder.rs1use crate::qdrant::*;
2
3#[must_use]
4#[derive(Clone)]
5pub struct UpdateCollectionClusterSetupRequestBuilder {
6 pub(crate) collection_name: Option<String>,
8 pub(crate) timeout: Option<Option<u64>>,
10 pub(crate) operation: Option<Option<update_collection_cluster_setup_request::Operation>>,
11}
12
13impl UpdateCollectionClusterSetupRequestBuilder {
14 pub fn collection_name(self, value: String) -> Self {
16 let mut new = self;
17 new.collection_name = Option::Some(value);
18 new
19 }
20 pub fn timeout(self, value: u64) -> Self {
22 let mut new = self;
23 new.timeout = Option::Some(Option::Some(value));
24 new
25 }
26 pub fn operation(
27 self,
28 value: Option<update_collection_cluster_setup_request::Operation>,
29 ) -> Self {
30 let mut new = self;
31 new.operation = Option::Some(value);
32 new
33 }
34
35 fn build_inner(
36 self,
37 ) -> Result<UpdateCollectionClusterSetupRequest, UpdateCollectionClusterSetupRequestBuilderError>
38 {
39 Ok(UpdateCollectionClusterSetupRequest {
40 collection_name: match self.collection_name {
41 Some(value) => value,
42 None => {
43 return Result::Err(core::convert::Into::into(
44 ::derive_builder::UninitializedFieldError::from("collection_name"),
45 ));
46 }
47 },
48 timeout: self.timeout.unwrap_or_default(),
49 operation: match self.operation {
50 Some(value) => value,
51 None => {
52 return Result::Err(core::convert::Into::into(
53 ::derive_builder::UninitializedFieldError::from("operation"),
54 ));
55 }
56 },
57 })
58 }
59 fn create_empty() -> Self {
61 Self {
62 collection_name: core::default::Default::default(),
63 timeout: core::default::Default::default(),
64 operation: core::default::Default::default(),
65 }
66 }
67}
68
69impl From<UpdateCollectionClusterSetupRequestBuilder> for UpdateCollectionClusterSetupRequest {
70 fn from(value: UpdateCollectionClusterSetupRequestBuilder) -> Self {
71 value.build_inner().unwrap_or_else(|_| {
72 panic!(
73 "Failed to convert {0} to {1}",
74 "UpdateCollectionClusterSetupRequestBuilder", "UpdateCollectionClusterSetupRequest"
75 )
76 })
77 }
78}
79
80impl UpdateCollectionClusterSetupRequestBuilder {
81 pub fn build(self) -> UpdateCollectionClusterSetupRequest {
83 self.build_inner().unwrap_or_else(|_| {
84 panic!(
85 "Failed to build {0} into {1}",
86 "UpdateCollectionClusterSetupRequestBuilder", "UpdateCollectionClusterSetupRequest"
87 )
88 })
89 }
90}
91
92impl UpdateCollectionClusterSetupRequestBuilder {
93 pub(crate) fn empty() -> Self {
94 Self::create_empty()
95 }
96}
97
98#[non_exhaustive]
99#[derive(Debug)]
100pub enum UpdateCollectionClusterSetupRequestBuilderError {
101 UninitializedField(&'static str),
103 ValidationError(String),
105}
106
107impl std::fmt::Display for UpdateCollectionClusterSetupRequestBuilderError {
109 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
110 match self {
111 Self::UninitializedField(field) => {
112 write!(f, "`{field}` must be initialized")
113 }
114 Self::ValidationError(error) => write!(f, "{error}"),
115 }
116 }
117}
118
119impl std::error::Error for UpdateCollectionClusterSetupRequestBuilderError {}
121
122impl From<derive_builder::UninitializedFieldError>
124 for UpdateCollectionClusterSetupRequestBuilderError
125{
126 fn from(error: derive_builder::UninitializedFieldError) -> Self {
127 Self::UninitializedField(error.field_name())
128 }
129}
130
131impl From<String> for UpdateCollectionClusterSetupRequestBuilderError {
133 fn from(error: String) -> Self {
134 Self::ValidationError(error)
135 }
136}