[][src]Struct mbus_api::client::Client

pub struct Client<F> where
    F: Future<Item = Response, Error = Error> + 'static, 
{ /* fields omitted */ }

A client that implements the API by making HTTP calls out to a server.

Methods

impl Client<FutureResponse>[src]

pub fn try_new_http(
    handle: Handle,
    base_path: &str
) -> Result<Client<FutureResponse>, ClientInitError>
[src]

Create an HTTP client.

Arguments

  • handle - tokio reactor handle to use for execution
  • base_path - base path of the client API, i.e. "www.my-api-implementation.com"

pub fn try_new_https<CA>(
    handle: Handle,
    base_path: &str,
    ca_certificate: CA
) -> Result<Client<FutureResponse>, ClientInitError> where
    CA: AsRef<Path>, 
[src]

Create a client with a TLS connection to the server.

Arguments

  • handle - tokio reactor handle to use for execution
  • base_path - base path of the client API, i.e. "www.my-api-implementation.com"
  • ca_certificate - Path to CA certificate used to authenticate the server

pub fn try_new_https_mutual<CA, K, C>(
    handle: Handle,
    base_path: &str,
    ca_certificate: CA,
    client_key: K,
    client_certificate: C
) -> Result<Client<FutureResponse>, ClientInitError> where
    CA: AsRef<Path>,
    K: AsRef<Path>,
    C: AsRef<Path>, 
[src]

Create a client with a mutually authenticated TLS connection to the server.

Arguments

  • handle - tokio reactor handle to use for execution
  • base_path - base path of the client API, i.e. "www.my-api-implementation.com"
  • ca_certificate - Path to CA certificate used to authenticate the server
  • client_key - Path to the client private key
  • client_certificate - Path to the client's public certificate associated with the private key

pub fn try_new_with_connector<C>(
    handle: Handle,
    base_path: &str,
    protocol: Option<&'static str>,
    connector_fn: Box<dyn Fn(&Handle) -> C + Send + Sync>
) -> Result<Client<FutureResponse>, ClientInitError> where
    C: Connect + Service, 
[src]

Create a client with a custom implementation of hyper::client::Connect.

Intended for use with custom implementations of connect for e.g. protocol logging or similar functionality which requires wrapping the transport layer. When wrapping a TCP connection, this function should be used in conjunction with swagger::{http_connector, https_connector, https_mutual_connector}.

For ordinary tcp connections, prefer the use of try_new_http, try_new_https and try_new_https_mutual, to avoid introducing a dependency on the underlying transport layer.

Arguments

  • handle - tokio reactor handle to use for execution
  • base_path - base path of the client API, i.e. "www.my-api-implementation.com"
  • protocol - Which protocol to use when constructing the request url, e.g. Some("http")
  • connector_fn - Function which returns an implementation of hyper::client::Connect

pub fn try_new_with_hyper_client(
    hyper_client: Arc<Box<dyn Service<Request = Request<Body>, Response = Response, Error = Error, Future = FutureResponse>>>,
    handle: Handle,
    base_path: &str
) -> Result<Client<FutureResponse>, ClientInitError>
[src]

Deprecated:

Use try_new_with_client_service instead

Constructor for creating a Client by passing in a pre-made hyper client.

One should avoid relying on this function if possible, since it adds a dependency on the underlying transport implementation, which it would be better to abstract away. Therefore, using this function may lead to a loss of code generality, which may make it harder to move the application to a serverless environment, for example.

The reason for this function's existence is to support legacy test code, which did mocking at the hyper layer. This is not a recommended way to write new tests. If other reasons are found for using this function, they should be mentioned here.

impl<F> Client<F> where
    F: Future<Item = Response, Error = Error> + 'static, 
[src]

pub fn try_new_with_client_service(
    client_service: Arc<Box<dyn Service<Request = Request<Body>, Response = Response, Error = Error, Future = F>>>,
    handle: Handle,
    base_path: &str
) -> Result<Client<F>, ClientInitError>
[src]

Constructor for creating a Client by passing in a pre-made hyper client Service.

This allows adding custom wrappers around the underlying transport, for example for logging.

Trait Implementations

impl<F, C> Api<C> for Client<F> where
    F: Future<Item = Response, Error = Error> + 'static,
    C: Has<XSpanIdString>, 
[src]

impl<F> Clone for Client<F> where
    F: Future<Item = Response, Error = Error> + 'static, 
[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<F> Debug for Client<F> where
    F: Future<Item = Response, Error = Error> + 'static, 
[src]

Auto Trait Implementations

impl<F> !Send for Client<F>

impl<F> !Sync for Client<F>

Blanket Implementations

impl<'a, T, C> ContextWrapperExt for T where
    T: Api<C>, 
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T