pub struct CachingCardResolver { /* private fields */ }Expand description
A caching agent card resolver.
Stores the last fetched card and uses conditional HTTP requests
(If-None-Match, If-Modified-Since) to avoid unnecessary re-downloads
(spec §8.3).
Implementations§
Source§impl CachingCardResolver
impl CachingCardResolver
Sourcepub fn new(base_url: &str) -> ClientResult<Self>
pub fn new(base_url: &str) -> ClientResult<Self>
Creates a new resolver for the given agent card URL.
§Errors
Returns ClientError::InvalidEndpoint if base_url is malformed
(empty, missing scheme, etc.).
Sourcepub fn with_path(base_url: &str, path: &str) -> ClientResult<Self>
pub fn with_path(base_url: &str, path: &str) -> ClientResult<Self>
Creates a new resolver with a custom path.
§Errors
Returns ClientError::InvalidEndpoint if base_url is malformed.
Sourcepub async fn resolve(&self) -> ClientResult<AgentCard>
pub async fn resolve(&self) -> ClientResult<AgentCard>
Resolves the agent card, using a cached version if valid.
Sends conditional request headers when a cached card exists. On 304,
returns the cached card. On 200, updates the cache and returns the
new card.
§Errors
Same conditions as resolve_agent_card.
Sourcepub async fn invalidate(&self)
pub async fn invalidate(&self)
Clears the internal cache.
Trait Implementations§
Source§impl Clone for CachingCardResolver
impl Clone for CachingCardResolver
Source§fn clone(&self) -> CachingCardResolver
fn clone(&self) -> CachingCardResolver
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CachingCardResolver
impl !RefUnwindSafe for CachingCardResolver
impl Send for CachingCardResolver
impl Sync for CachingCardResolver
impl Unpin for CachingCardResolver
impl UnsafeUnpin for CachingCardResolver
impl !UnwindSafe for CachingCardResolver
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