Trait UserMessage

Source
pub trait UserMessage:
    'static
    + Send
    + Debug
    + Clone
    + DeserializeOwned
    + Serialize
    + JsonSchema { }
Expand description

A combination trait which represents all of the traits needed for a type to be used as a message with this library.

§Note on JsonSchema

JsonSchema is a trait from the schemars crate. Deriving it for your message allows ipc-rpc to perform validation on message schemas after communication has started. The results of this validation are logged, and stored in IpcRpcClient::schema_validated, IpcRpcServer::schema_validated, and IpcRpc::schema_validated. A failed validation will not crash the program.

Despite what this may imply, ipc-rpc does not use JSON for messages internally.

If you find yourself unable to derive JsonSchema then consider turning off default features for the ipc-rpc crate. Once you do, the JsonSchema requirement will go away.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> UserMessage for T
where T: 'static + Send + Debug + Clone + DeserializeOwned + Serialize + JsonSchema,