[−][src]Struct mbus_api::client::Client
A client that implements the API by making HTTP calls out to a server.
Implementations
impl<Connector, C> Client<DropContextService<Client<Connector, Body>, C>, C> where
Connector: Connect + Clone + Send + Sync + 'static,
C: Clone + Send + Sync + 'static,
[src]
Connector: Connect + Clone + Send + Sync + 'static,
C: Clone + Send + Sync + 'static,
pub fn try_new_with_connector(
base_path: &str,
protocol: Option<&'static str>,
connector: Connector
) -> Result<Self, ClientInitError>
[src]
base_path: &str,
protocol: Option<&'static str>,
connector: Connector
) -> Result<Self, ClientInitError>
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. "http://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
impl<C> Client<DropContextService<HyperClient, C>, C> where
C: Clone + Send + Sync + 'static,
[src]
C: Clone + Send + Sync + 'static,
pub fn try_new(base_path: &str) -> Result<Self, ClientInitError>
[src]
Create an HTTP client.
Arguments
base_path
- base path of the client API, i.e. "http://www.my-api-implementation.com"
impl<C> Client<DropContextService<Client<HttpConnector, Body>, C>, C> where
C: Clone + Send + Sync + 'static,
[src]
C: Clone + Send + Sync + 'static,
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. "http://www.my-api-implementation.com"
impl<C> Client<DropContextService<Client<HttpsConnector<HttpConnector>, Body>, C>, C> where
C: Clone + Send + Sync + 'static,
[src]
C: Clone + Send + Sync + 'static,
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. "https://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. "https://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. "https://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<S, C> Client<S, C> where
S: Service<(Request<Body>, C), Response = Response<Body>> + Clone + Sync + Send + 'static,
S::Future: Send + 'static,
S::Error: Into<Box<dyn Error + Send + Sync + 'static>> + Display,
C: Clone + Send + Sync + 'static,
[src]
S: Service<(Request<Body>, C), Response = Response<Body>> + Clone + Sync + Send + 'static,
S::Future: Send + 'static,
S::Error: Into<Box<dyn Error + Send + Sync + 'static>> + Display,
C: Clone + Send + Sync + 'static,
pub fn try_new_with_client_service(
client_service: S,
base_path: &str
) -> Result<Self, ClientInitError>
[src]
client_service: S,
base_path: &str
) -> Result<Self, ClientInitError>
Constructor for creating a Client
by passing in a pre-made hyper::service::Service
/
tower::Service
This allows adding custom wrappers around the underlying transport, for example for logging.
Trait Implementations
impl<S, C> Api<C> for Client<S, C> where
S: Service<(Request<Body>, C), Response = Response<Body>> + Clone + Sync + Send + 'static,
S::Future: Send + 'static,
S::Error: Into<Box<dyn Error + Send + Sync + 'static>> + Display,
C: Has<XSpanIdString> + Clone + Send + Sync + 'static,
[src]
S: Service<(Request<Body>, C), Response = Response<Body>> + Clone + Sync + Send + 'static,
S::Future: Send + 'static,
S::Error: Into<Box<dyn Error + Send + Sync + 'static>> + Display,
C: Has<XSpanIdString> + Clone + Send + Sync + 'static,
fn poll_ready(
&self,
cx: &mut Context
) -> Poll<Result<(), Box<dyn Error + Send + Sync + 'static>>>
[src]
&self,
cx: &mut Context
) -> Poll<Result<(), Box<dyn Error + Send + Sync + 'static>>>
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
param_device: String,
param_baudrate: Baudrate,
param_address: i32,
context: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<GetResponse, ApiError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
param_device: String,
param_baudrate: Baudrate,
param_address: i32,
context: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<GetResponse, ApiError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_multi<'life0, 'life1, 'async_trait>(
&'life0 self,
param_device: String,
param_baudrate: Baudrate,
param_address: i32,
param_maxframes: i32,
context: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<GetMultiResponse, ApiError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
param_device: String,
param_baudrate: Baudrate,
param_address: i32,
param_maxframes: i32,
context: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<GetMultiResponse, ApiError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn hat<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<HatResponse, ApiError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
context: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<HatResponse, ApiError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn hat_off<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<HatOffResponse, ApiError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
context: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<HatOffResponse, ApiError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn hat_on<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<HatOnResponse, ApiError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
context: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<HatOnResponse, ApiError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn mbus_api<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<MbusApiResponse, ApiError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
context: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<MbusApiResponse, ApiError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn scan<'life0, 'life1, 'async_trait>(
&'life0 self,
param_device: String,
param_baudrate: Baudrate,
context: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<ScanResponse, ApiError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
param_device: String,
param_baudrate: Baudrate,
context: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<ScanResponse, ApiError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
impl<S, C> Clone for Client<S, C> where
S: Service<(Request<Body>, C), Response = Response<Body>> + Clone + Sync + Send + 'static,
S::Future: Send + 'static,
S::Error: Into<Box<dyn Error + Send + Sync + 'static>> + Display,
C: Clone + Send + Sync + 'static,
[src]
S: Service<(Request<Body>, C), Response = Response<Body>> + Clone + Sync + Send + 'static,
S::Future: Send + 'static,
S::Error: Into<Box<dyn Error + Send + Sync + 'static>> + Display,
C: Clone + Send + Sync + 'static,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<S, C> Debug for Client<S, C> where
S: Service<(Request<Body>, C), Response = Response<Body>> + Clone + Sync + Send + 'static,
S::Future: Send + 'static,
S::Error: Into<Box<dyn Error + Send + Sync + 'static>> + Display,
C: Clone + Send + Sync + 'static,
[src]
S: Service<(Request<Body>, C), Response = Response<Body>> + Clone + Sync + Send + 'static,
S::Future: Send + 'static,
S::Error: Into<Box<dyn Error + Send + Sync + 'static>> + Display,
C: Clone + Send + Sync + 'static,
Auto Trait Implementations
impl<S, C> RefUnwindSafe for Client<S, C> where
S: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, C> Send for Client<S, C>
impl<S, C> Sync for Client<S, C>
impl<S, C> Unpin for Client<S, C> where
S: Unpin,
S: Unpin,
impl<S, C> UnwindSafe for Client<S, C> where
S: UnwindSafe,
S: UnwindSafe,
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<T, C> ContextWrapperExt<C> for T where
C: Clone + Send + Sync,
T: Api<C> + Send + Sync,
[src]
C: Clone + Send + Sync,
T: Api<C> + Send + Sync,
fn with_context(Self, C) -> ContextWrapper<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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,