pub trait BackendReceiver: Send + 'static {
// Required method
fn receive(
&self,
) -> Pin<Box<dyn Future<Output = Option<Result<Vec<u8>, BackendError>>> + Send + 'static>>;
}
Expand description
Something that can receive bytes.
Required Methods§
Sourcefn receive(
&self,
) -> Pin<Box<dyn Future<Output = Option<Result<Vec<u8>, BackendError>>> + Send + 'static>>
fn receive( &self, ) -> Pin<Box<dyn Future<Output = Option<Result<Vec<u8>, BackendError>>> + Send + 'static>>
Hand back the next message each time it’s called. If this emits a BackendError
, we’ll
stop asking for messages. If it emits None
, then the connection has been closed gracefully.
The bytes given back should deserialize to a valid JSON-RPC object.