Struct station::rpc::RpcServer [−][src]
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]
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,
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 tocallback
: 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]
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,
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 tocallback
: 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
Auto Trait Implementations
impl !RefUnwindSafe for RpcServer
impl Send for RpcServer
impl Sync for RpcServer
impl Unpin for RpcServer
impl !UnwindSafe for RpcServer
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>,