Struct msgpack_rpc::Endpoint
[−]
[src]
pub struct Endpoint { /* fields omitted */ }
An endpoint represents a peer of MessagePack-RPC.
Methods
impl Endpoint
[src]
fn from_io<T: AsyncRead + AsyncWrite + 'static>(handle: &Handle, io: T) -> Self
[src]
Create a RPC endpoint from asyncrhonous I/O.
fn client(&self) -> &Client
[src]
Return the reference of Client
associated with the endpoint.
fn into_client(self) -> Client
[src]
Return the instance of Client
associated with the endpoint.
This function is useful if the endpoint doesn't handle any incoming requests/notifications.
If the endpoint requires to serve requests/notifications, use Endpoint::serve()
instead.
fn serve<H: Handler>(self, handle: &Handle, handler: H) -> Client
[src]
Start to serve incoming requests.
This function does not block current thread, but returns an instance of Client
associated
with the I/O.
If you want to run the event loop infinitely, use futures::future::empty()
as follows:
let mut core = Core::new().unwrap(); endpoint.serve(&core.handle(), foo); let _: Result<(), ()> = core.run(empty());