Crate ezrpc

Crate ezrpc 

Source
Expand description

§Features

  • Ergonomic: the arguments type of RPC method can be any type which impls serde::Deserialize, and the returned type can be any type which impls serde::Serialize
  • Zero-copy: the arguments type and returned type of RPC method can be reference type such as &[u8], &str, equivalent to reference to the data in packet buffer, without any copy
  • Asynchronous support
  • WebAssembly support:provides built-in bindings to WebSocket via wasm-bindgen, you can use this crate in WASM,and exposed interfaces to JavaScript to use it in browser, check out the binding
  • Flexible: multiple communication method support, and you can impl the Adapter trait to custom the communication method
    1. Network: Based WebSocket,it can be used to communicate with Web(via WASM),and can also be used for communication between two processes on the network
    2. IPC(Inter-Process Communication): Based named pipe on Windows, while based domain socket on Linux
    3. Inner-Process Communication:Based tokio’s channel,can be used for communication between different threads in the same process

Modules§

channel
Channel adapter implementation, for in-process communication
error
Error types
ipc
Named pipe(Windows) and domain socket(Unix) adapter implementation, for Inter-Process Communication
ws
Websocket adapter implementation, for network communication, can also be used in WebPage via WASM

Macros§

ezrpc
The ezrpc macro, for RPC intefaces declaration

Structs§

MappedService
The default and common Service implementation
Packet
Represents a packet unit for ezrpc
RpcContext
Context information in the duration of a RPC
Session
Represents a RPC session.
StreamReceiver
StreamSender

Constants§

NOTIFY
REQUEST
RESPONSE
RESPONSE_STREAM

Traits§

Adapter
Adapter for different kinds of communication
FromPacket
Trait for types which can be converted by a Packet
MethodReturn
Trait for types that can be returned by RPC method, is commonly serializable type, or a result wrapper for it
NeedSend
Types that can be transferred across thread boundaries.
SerdeMethod
Trait for closures which can be converted to RPC method
Service
The service object, for RPC method handling

Type Aliases§

ArcRpcContext
Alias for Arc<RpcContext>
Method
The type of RPC method id, is commonly string or integer, but can be any serializable types
RpcMethod
The most original RPC method
ServiceResult
The Future object returned from the service