pub struct CardFetchOptions { /* private fields */ }Expand description
What a card fetch sends and how long it may take.
resolve_agent_card and fetch_card_from_url send no headers and
allow the whole call 30 seconds. Both were fixed until 0.12, which meant a
card behind authentication could not be fetched at all and the budget
could not be shortened for a peer that is expected to answer at once. The
_with_options variants take one of these instead.
The timeout is one deadline for connect, headers and body together — see the note on the default — not a per-phase bound.
use std::time::Duration;
use a2a_protocol_client::discovery::CardFetchOptions;
let options = CardFetchOptions::default()
.with_header("authorization", "Bearer s3cret")
.with_timeout(Duration::from_secs(5));
assert_eq!(options.timeout(), Duration::from_secs(5));
assert_eq!(options.headers().len(), 1);Implementations§
Source§impl CardFetchOptions
impl CardFetchOptions
Sourcepub fn with_header(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_header( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
Adds one header to the request. An invalid name or value is reported
by the fetch as ClientError::Transport, not here.
Sourcepub fn with_headers(self, headers: HashMap<String, String>) -> Self
pub fn with_headers(self, headers: HashMap<String, String>) -> Self
Replaces the headers sent with the request.
Sourcepub const fn with_timeout(self, timeout: Duration) -> Self
pub const fn with_timeout(self, timeout: Duration) -> Self
Sets the budget for the whole fetch: connect, headers and body.
Trait Implementations§
Source§impl Clone for CardFetchOptions
impl Clone for CardFetchOptions
Source§impl Debug for CardFetchOptions
impl Debug for CardFetchOptions
Auto Trait Implementations§
impl Freeze for CardFetchOptions
impl RefUnwindSafe for CardFetchOptions
impl Send for CardFetchOptions
impl Sync for CardFetchOptions
impl Unpin for CardFetchOptions
impl UnsafeUnpin for CardFetchOptions
impl UnwindSafe for CardFetchOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request