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>,
) -> CardFetchOptions
pub fn with_header( self, name: impl Into<String>, value: impl Into<String>, ) -> CardFetchOptions
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>) -> CardFetchOptions
pub fn with_headers(self, headers: HashMap<String, String>) -> CardFetchOptions
Replaces the headers sent with the request.
Sourcepub const fn with_timeout(self, timeout: Duration) -> CardFetchOptions
pub const fn with_timeout(self, timeout: Duration) -> CardFetchOptions
Sets the budget for the whole fetch: connect, headers and body.
Trait Implementations§
Source§impl Clone for CardFetchOptions
impl Clone for CardFetchOptions
Source§fn clone(&self) -> CardFetchOptions
fn clone(&self) -> CardFetchOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CardFetchOptions
impl Debug for CardFetchOptions
Source§impl Default for CardFetchOptions
impl Default for CardFetchOptions
Source§fn default() -> CardFetchOptions
fn default() -> CardFetchOptions
No headers; the 30-second budget the plain functions use.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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>
T in a tonic::Request