pub trait Command: Clone {
// Required methods
fn commands() -> Vec<String>;
fn serialize<T: Serializer>(&self, serializer: T) -> Result<T::Ok, T::Error>;
fn deserialize<'de, T: Deserializer<'de>>(
deserializer: T,
) -> Result<Self, T::Error>
where Self: Sized;
}Expand description
Defines a command that can be executed by this server.
Instead of implementing this trait manually, you can use the Command derive macro.
If you do so, you must also derive Clone.
Implementing this trait manually might break the connection if not done properly.
Required Methods§
Sourcefn serialize<T: Serializer>(&self, serializer: T) -> Result<T::Ok, T::Error>
fn serialize<T: Serializer>(&self, serializer: T) -> Result<T::Ok, T::Error>
This is beeing forwared to the serde::Serialize::serialize implementation.
Sourcefn deserialize<'de, T: Deserializer<'de>>(
deserializer: T,
) -> Result<Self, T::Error>where
Self: Sized,
fn deserialize<'de, T: Deserializer<'de>>(
deserializer: T,
) -> Result<Self, T::Error>where
Self: Sized,
This is beeing forwared to the serde::Deserialize::deserialize implementation.
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.