Trait mz_proto::ProtoType

source ·
pub trait ProtoType<Rust>: Sized {
    // Required methods
    fn into_rust(self) -> Result<Rust, TryFromProtoError>;
    fn from_rust(rust: &Rust) -> Self;
}
Expand description

The symmetric counterpart of RustType, similar to what Into is to From.

The Rust parameter is generic, as opposed to the Proto associated type in RustType because the same Protobuf type can be used to encode many different Rust types.

Clients should only implement RustType.

Required Methods§

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<P, R> ProtoType<R> for P
where R: RustType<P>,

Blanket implementation for ProtoType, so clients only need to implement RustType.