Struct station::rpc::RpcServer[][src]

pub struct RpcServer { /* fields omitted */ }

The RPC server listens for incoming messages of type T, processes them, and returns a result containing bytes that can be deserialized to the type U.

Implementations

impl RpcServer[src]

pub fn with_tcp_port<T, U>(
    name: &'static str,
    port: u16,
    callback: Box<dyn Send + Fn(T) -> Result<U, String>>
) -> RpcServer where
    T: Debug + DeserializeOwned + Serialize + 'static,
    U: Debug + DeserializeOwned + Serialize + 'static, 
[src]

Create an RPC server bound to a TCP port.

Args:

  • name: A name to refer to the RPC server.
  • port: The TCP port to bind the server to
  • callback: The function to call on incoming data.

pub fn with_unix_socket<T, U>(
    name: &'static str,
    path: &str,
    callback: Box<dyn Send + Fn(T) -> Result<U, String>>
) -> RpcServer where
    T: Debug + DeserializeOwned + Serialize + 'static,
    U: Debug + DeserializeOwned + Serialize + 'static, 
[src]

Create an RPC server bound to a Unix socket.

Args:

  • name: A name to refer to the RPC server.
  • path: The unix socket path to bind the server to
  • callback: The function to call on incoming data.

pub fn is_running(&self) -> bool[src]

Check if the RPC server is running.

pub fn stop(&mut self)[src]

Stop the RPC server.

Trait Implementations

impl Drop for RpcServer[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.