qdrant_client/builders/
delete_snapshot_request_builder.rs1use crate::qdrant::*;
2
3pub struct DeleteSnapshotRequestBuilder {
4 pub(crate) collection_name: Option<String>,
6 pub(crate) snapshot_name: Option<String>,
8}
9
10impl DeleteSnapshotRequestBuilder {
11 #[allow(unused_mut)]
13 pub fn collection_name(self, value: String) -> Self {
14 let mut new = self;
15 new.collection_name = Option::Some(value);
16 new
17 }
18 #[allow(unused_mut)]
20 pub fn snapshot_name(self, value: String) -> Self {
21 let mut new = self;
22 new.snapshot_name = Option::Some(value);
23 new
24 }
25
26 fn build_inner(self) -> Result<DeleteSnapshotRequest, DeleteSnapshotRequestBuilderError> {
27 Ok(DeleteSnapshotRequest {
28 collection_name: match self.collection_name {
29 Some(value) => value,
30 None => {
31 return Result::Err(core::convert::Into::into(
32 ::derive_builder::UninitializedFieldError::from("collection_name"),
33 ));
34 }
35 },
36 snapshot_name: match self.snapshot_name {
37 Some(value) => value,
38 None => {
39 return Result::Err(core::convert::Into::into(
40 ::derive_builder::UninitializedFieldError::from("snapshot_name"),
41 ));
42 }
43 },
44 })
45 }
46 fn create_empty() -> Self {
48 Self {
49 collection_name: core::default::Default::default(),
50 snapshot_name: core::default::Default::default(),
51 }
52 }
53}
54
55impl From<DeleteSnapshotRequestBuilder> for DeleteSnapshotRequest {
56 fn from(value: DeleteSnapshotRequestBuilder) -> Self {
57 value.build_inner().unwrap_or_else(|_| {
58 panic!(
59 "Failed to convert {0} to {1}",
60 "DeleteSnapshotRequestBuilder", "DeleteSnapshotRequest"
61 )
62 })
63 }
64}
65
66impl DeleteSnapshotRequestBuilder {
67 pub fn build(self) -> DeleteSnapshotRequest {
69 self.build_inner().unwrap_or_else(|_| {
70 panic!(
71 "Failed to build {0} into {1}",
72 "DeleteSnapshotRequestBuilder", "DeleteSnapshotRequest"
73 )
74 })
75 }
76}
77
78impl DeleteSnapshotRequestBuilder {
79 pub(crate) fn empty() -> Self {
80 Self::create_empty()
81 }
82}
83
84#[non_exhaustive]
86#[derive(Debug)]
87pub enum DeleteSnapshotRequestBuilderError {
88 UninitializedField(&'static str),
90 ValidationError(String),
92}
93
94impl std::fmt::Display for DeleteSnapshotRequestBuilderError {
96 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
97 match self {
98 Self::UninitializedField(field) => {
99 write!(f, "`{}` must be initialized", field)
100 }
101 Self::ValidationError(error) => write!(f, "{}", error),
102 }
103 }
104}
105
106impl std::error::Error for DeleteSnapshotRequestBuilderError {}
108
109impl From<derive_builder::UninitializedFieldError> for DeleteSnapshotRequestBuilderError {
111 fn from(error: derive_builder::UninitializedFieldError) -> Self {
112 Self::UninitializedField(error.field_name())
113 }
114}
115
116impl From<String> for DeleteSnapshotRequestBuilderError {
118 fn from(error: String) -> Self {
119 Self::ValidationError(error)
120 }
121}