a2a_protocol_client/config/
setters.rs1use std::time::Duration;
8
9use super::{ClientConfig, TlsConfig};
10
11impl ClientConfig {
12 #[must_use]
15 #[deprecated(
16 since = "0.15.0",
17 note = "nothing reads `preferred_bindings`: `from_card` follows the card's interface \
18 order (spec ยง8.3.2); pass a ranking to `ClientBuilder::from_card_preferring`"
19 )]
20 #[allow(deprecated)]
21 pub fn with_preferred_bindings(mut self, bindings: Vec<String>) -> Self {
22 self.preferred_bindings = bindings;
23 self
24 }
25
26 #[must_use]
28 pub fn with_accepted_output_modes(mut self, modes: Vec<String>) -> Self {
29 self.accepted_output_modes = modes;
30 self
31 }
32
33 #[must_use]
35 pub const fn with_history_length(mut self, length: Option<u32>) -> Self {
36 self.history_length = length;
37 self
38 }
39
40 #[must_use]
42 pub const fn with_return_immediately(mut self, val: bool) -> Self {
43 self.return_immediately = val;
44 self
45 }
46
47 #[must_use]
49 pub const fn with_blocking_over_stream(mut self, val: bool) -> Self {
50 self.blocking_over_stream = val;
51 self
52 }
53
54 #[must_use]
56 pub const fn with_request_timeout(mut self, timeout: Duration) -> Self {
57 self.request_timeout = timeout;
58 self
59 }
60
61 #[must_use]
63 pub const fn with_send_timeout(mut self, timeout: Duration) -> Self {
64 self.send_timeout = timeout;
65 self
66 }
67
68 #[must_use]
71 pub const fn with_stream_connect_timeout(mut self, timeout: Duration) -> Self {
72 self.stream_connect_timeout = timeout;
73 self
74 }
75
76 #[must_use]
79 pub const fn with_stream_first_event_timeout(mut self, timeout: Duration) -> Self {
80 self.stream_first_event_timeout = timeout;
81 self
82 }
83
84 #[must_use]
86 pub const fn with_connection_timeout(mut self, timeout: Duration) -> Self {
87 self.connection_timeout = timeout;
88 self
89 }
90
91 #[must_use]
95 pub const fn with_stream_idle_timeout(mut self, timeout: Option<Duration>) -> Self {
96 self.stream_idle_timeout = timeout;
97 self
98 }
99
100 #[must_use]
104 pub const fn with_max_response_size(mut self, max_bytes: usize) -> Self {
105 self.max_response_size = max_bytes;
106 self
107 }
108
109 #[must_use]
112 pub const fn with_max_event_size(mut self, max_bytes: usize) -> Self {
113 self.max_event_size = max_bytes;
114 self
115 }
116
117 #[cfg_attr(not(feature = "tls-rustls"), allow(clippy::missing_const_for_fn))]
121 #[must_use]
122 pub fn with_tls(mut self, tls: TlsConfig) -> Self {
123 self.tls = tls;
124 self
125 }
126
127 #[must_use]
129 pub fn with_tenant(mut self, tenant: Option<String>) -> Self {
130 self.tenant = tenant;
131 self
132 }
133}