Struct station::rpc::RpcClient [−][src]
The RPC client sends data of type T
to a server and expects a response of type U
.
It is extremely important that the types on the client and server match, else the RPC calls will likely fail.
Implementations
impl<T, U> RpcClient<T, U> where
T: DeserializeOwned + Serialize + 'static,
U: DeserializeOwned + Serialize + 'static,
[src]
T: DeserializeOwned + Serialize + 'static,
U: DeserializeOwned + Serialize + 'static,
pub fn with_tcp_addr(addr: SocketAddr) -> RpcClient<T, U>
[src]
Create an RPC client pointing to a TCP socket address.
pub fn with_unix_socket(path: &str) -> RpcClient<T, U>
[src]
Create an RPC client pointing to a Unix socket address.
pub fn call(&self, request: T, timeout: Duration) -> Result<U, RpcError>
[src]
Call the RPC and return the response.
If the types used to initialize the RPC client differ from the RPC server, some very
cryptic errors can occur. Since bincode
is used for serialization, the type of error can
differ depending on where the deserialization occurs. In any case, it’s important to make
sure types are matched properly when creating RPC servers and clients.
pub fn ping(&self, timeout: Duration) -> bool
[src]
Check if the corresponding RPC server is online.
pub fn wait_for_server(&self, ping_timeout: Duration)
[src]
Wait indefinitely for the RPC server to come online.
Auto Trait Implementations
impl<T, U> !RefUnwindSafe for RpcClient<T, U>
impl<T, U> !Send for RpcClient<T, U>
impl<T, U> !Sync for RpcClient<T, U>
impl<T, U> Unpin for RpcClient<T, U>
impl<T, U> !UnwindSafe for RpcClient<T, U>
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,
pub fn borrow_mut(&mut self) -> &mut T
[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, 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.
pub 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>,