pub struct RestTransport { /* private fields */ }Expand description
REST transport: HTTP verbs mapped to REST paths.
Create via RestTransport::new or let crate::ClientBuilder construct
one from the agent card.
Implementations§
Source§impl RestTransport
impl RestTransport
Sourcepub fn new(base_url: impl Into<String>) -> Result<RestTransport, ClientError>
pub fn new(base_url: impl Into<String>) -> Result<RestTransport, ClientError>
Creates a new transport using base_url as the root URL.
§Errors
Returns ClientError::InvalidEndpoint if the URL is malformed.
Sourcepub fn with_timeout(
base_url: impl Into<String>,
request_timeout: Duration,
) -> Result<RestTransport, ClientError>
pub fn with_timeout( base_url: impl Into<String>, request_timeout: Duration, ) -> Result<RestTransport, ClientError>
Creates a new transport with a custom request timeout.
§Errors
Returns ClientError::InvalidEndpoint if the URL is malformed.
Sourcepub fn with_timeouts(
base_url: impl Into<String>,
request_timeout: Duration,
stream_connect_timeout: Duration,
) -> Result<RestTransport, ClientError>
pub fn with_timeouts( base_url: impl Into<String>, request_timeout: Duration, stream_connect_timeout: Duration, ) -> Result<RestTransport, ClientError>
Creates a new transport with separate request and stream connect timeouts.
§Errors
Returns ClientError::InvalidEndpoint if the URL is malformed.
Trait Implementations§
Source§impl Clone for RestTransport
impl Clone for RestTransport
Source§fn clone(&self) -> RestTransport
fn clone(&self) -> RestTransport
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 moreSource§impl Debug for RestTransport
impl Debug for RestTransport
Source§impl Transport for RestTransport
impl Transport for RestTransport
Source§fn send_request<'a>(
&'a self,
method: &'a str,
params: Value,
extra_headers: &'a HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<Value, ClientError>> + Send + 'a>>
fn send_request<'a>( &'a self, method: &'a str, params: Value, extra_headers: &'a HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<Value, ClientError>> + Send + 'a>>
Sends a non-streaming JSON-RPC or REST request. Read more
Source§fn send_streaming_request<'a>(
&'a self,
method: &'a str,
params: Value,
extra_headers: &'a HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<EventStream, ClientError>> + Send + 'a>>
fn send_streaming_request<'a>( &'a self, method: &'a str, params: Value, extra_headers: &'a HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<EventStream, ClientError>> + Send + 'a>>
Sends a streaming request and returns an
EventStream. Read moreAuto Trait Implementations§
impl Freeze for RestTransport
impl !RefUnwindSafe for RestTransport
impl Send for RestTransport
impl Sync for RestTransport
impl Unpin for RestTransport
impl UnsafeUnpin for RestTransport
impl !UnwindSafe for RestTransport
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