[−][src]Struct mbus_api::client::Client
A client that implements the API by making HTTP calls out to a server.
Implementations
impl Client<ResponseFuture>
[src]
pub fn try_new_with_connector<C>(
base_path: &str,
protocol: Option<&'static str>,
connector: C
) -> Result<Self, ClientInitError> where
C: Connect + 'static,
C::Transport: 'static,
C::Future: 'static,
[src]
base_path: &str,
protocol: Option<&'static str>,
connector: C
) -> Result<Self, ClientInitError> where
C: Connect + 'static,
C::Transport: 'static,
C::Future: 'static,
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::Connector::builder()
.
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
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
- Implementation ofhyper::client::Connect
to use for the client
pub fn try_new_http(base_path: &str) -> Result<Self, ClientInitError>
[src]
Create an HTTP client.
Arguments
base_path
- base path of the client API, i.e. "www.my-api-implementation.com"
pub fn try_new_https(base_path: &str) -> Result<Self, ClientInitError>
[src]
Create a client with a TLS connection to the server
Arguments
base_path
- base path of the client API, i.e. "www.my-api-implementation.com"
pub fn try_new_https_pinned<CA>(
base_path: &str,
ca_certificate: CA
) -> Result<Self, ClientInitError> where
CA: AsRef<Path>,
[src]
base_path: &str,
ca_certificate: CA
) -> Result<Self, ClientInitError> where
CA: AsRef<Path>,
Create a client with a TLS connection to the server using a pinned certificate
Arguments
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, D>(
base_path: &str,
ca_certificate: CA,
client_key: K,
client_certificate: D
) -> Result<Self, ClientInitError> where
CA: AsRef<Path>,
K: AsRef<Path>,
D: AsRef<Path>,
[src]
base_path: &str,
ca_certificate: CA,
client_key: K,
client_certificate: D
) -> Result<Self, ClientInitError> where
CA: AsRef<Path>,
K: AsRef<Path>,
D: AsRef<Path>,
Create a client with a mutually authenticated TLS connection to the server.
Arguments
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 serverclient_key
- Path to the client private keyclient_certificate
- Path to the client's public certificate associated with the private key
impl<F> Client<F>
[src]
pub fn try_new_with_client_service(
client_service: Arc<Box<dyn Service<ReqBody = Body, Future = F> + Send + Sync>>,
base_path: &str
) -> Result<Self, ClientInitError>
[src]
client_service: Arc<Box<dyn Service<ReqBody = Body, Future = F> + Send + Sync>>,
base_path: &str
) -> Result<Self, ClientInitError>
Constructor for creating a Client
by passing in a pre-made swagger::Service
This allows adding custom wrappers around the underlying transport, for example for logging.
Trait Implementations
impl<C, F> Api<C> for Client<F> where
C: Has<XSpanIdString>,
F: Future<Item = Response<Body>, Error = Error> + Send + 'static,
[src]
C: Has<XSpanIdString>,
F: Future<Item = Response<Body>, Error = Error> + Send + 'static,
fn get(
&self,
param_device: String,
param_baudrate: Baudrate,
param_address: i32,
context: &C
) -> Box<dyn Future<Item = GetResponse, Error = ApiError> + Send>
[src]
&self,
param_device: String,
param_baudrate: Baudrate,
param_address: i32,
context: &C
) -> Box<dyn Future<Item = GetResponse, Error = ApiError> + Send>
fn get_multi(
&self,
param_device: String,
param_baudrate: Baudrate,
param_address: i32,
param_maxframes: i32,
context: &C
) -> Box<dyn Future<Item = GetMultiResponse, Error = ApiError> + Send>
[src]
&self,
param_device: String,
param_baudrate: Baudrate,
param_address: i32,
param_maxframes: i32,
context: &C
) -> Box<dyn Future<Item = GetMultiResponse, Error = ApiError> + Send>
fn hat(
&self,
context: &C
) -> Box<dyn Future<Item = HatResponse, Error = ApiError> + Send>
[src]
&self,
context: &C
) -> Box<dyn Future<Item = HatResponse, Error = ApiError> + Send>
fn hat_off(
&self,
context: &C
) -> Box<dyn Future<Item = HatOffResponse, Error = ApiError> + Send>
[src]
&self,
context: &C
) -> Box<dyn Future<Item = HatOffResponse, Error = ApiError> + Send>
fn hat_on(
&self,
context: &C
) -> Box<dyn Future<Item = HatOnResponse, Error = ApiError> + Send>
[src]
&self,
context: &C
) -> Box<dyn Future<Item = HatOnResponse, Error = ApiError> + Send>
fn mbus_api(
&self,
context: &C
) -> Box<dyn Future<Item = MbusApiResponse, Error = ApiError> + Send>
[src]
&self,
context: &C
) -> Box<dyn Future<Item = MbusApiResponse, Error = ApiError> + Send>
fn scan(
&self,
param_device: String,
param_baudrate: Baudrate,
context: &C
) -> Box<dyn Future<Item = ScanResponse, Error = ApiError> + Send>
[src]
&self,
param_device: String,
param_baudrate: Baudrate,
context: &C
) -> Box<dyn Future<Item = ScanResponse, Error = ApiError> + Send>
impl<F> Clone for Client<F>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<F> Debug for Client<F>
[src]
Auto Trait Implementations
impl<F> !RefUnwindSafe for Client<F>
impl<F> Send for Client<F>
impl<F> Sync for Client<F>
impl<F> Unpin for Client<F>
impl<F> !UnwindSafe for Client<F>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<'a, T, C> ContextWrapperExt<'a, C> for T where
T: Api<C>,
[src]
T: Api<C>,
fn with_context(&'a Self, C) -> ContextWrapper<'a, T, C>
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,