Skip to main content

MessageProxy

Trait MessageProxy 

Source
pub trait MessageProxy: From<Self::Message> + Into<Self::Message> {
    type Message: ProtoMessage + ValidatedMessage + From<Self> + Into<Self>;

    // Provided methods
    fn into_message(self) -> Self::Message { ... }
    fn into_validated_message(self) -> Result<Self::Message, ValidationErrors> { ... }
    fn from_validated_message(
        msg: Self::Message,
    ) -> Result<Self, ValidationErrors> { ... }
}
Expand description

Implemented for message proxies by the proto_message macro.

Required Associated Types§

Provided Methods§

Source

fn into_message(self) -> Self::Message

Converts into the associated message.

Source

fn into_validated_message(self) -> Result<Self::Message, ValidationErrors>

Consumes the proxy and converts into the related message, and then validates the result.

Source

fn from_validated_message(msg: Self::Message) -> Result<Self, ValidationErrors>

Validates the message, and converts to the proxy if the validation is successful.

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§