qdrant_client/builders/
context_input_builder.rs1use crate::qdrant::*;
2
3#[derive(Clone)]
4pub struct ContextInputBuilder {
5 pub(crate) pairs: Option<Vec<ContextInputPair>>,
7}
8
9impl ContextInputBuilder {
10 pub fn pairs<VALUE: core::convert::Into<Vec<ContextInputPair>>>(self, value: VALUE) -> Self {
12 let mut new = self;
13 new.pairs = Option::Some(value.into());
14 new
15 }
16
17 fn build_inner(self) -> Result<ContextInput, std::convert::Infallible> {
18 Ok(ContextInput {
19 pairs: self.pairs.unwrap_or_default(),
20 })
21 }
22 fn create_empty() -> Self {
24 Self {
25 pairs: core::default::Default::default(),
26 }
27 }
28}
29
30impl From<ContextInputBuilder> for ContextInput {
31 fn from(value: ContextInputBuilder) -> Self {
32 value.build_inner().unwrap_or_else(|_| {
33 panic!(
34 "Failed to convert {0} to {1}",
35 "ContextInputBuilder", "ContextInput"
36 )
37 })
38 }
39}
40
41impl ContextInputBuilder {
42 pub fn build(self) -> ContextInput {
44 self.build_inner().unwrap_or_else(|_| {
45 panic!(
46 "Failed to build {0} into {1}",
47 "ContextInputBuilder", "ContextInput"
48 )
49 })
50 }
51}
52
53impl Default for ContextInputBuilder {
54 fn default() -> Self {
55 Self::create_empty()
56 }
57}