IntoProto

Trait IntoProto 

Source
pub trait IntoProto<P>: Sized {
    // Required method
    fn into_proto(self) -> P;
}
Expand description

A value-to-value conversion that consumes the input value. The opposite of FromNative.

One should avoid implementing IntoProto and implement FromNative instead. Implementing FromNative automatically provides one with an implementation of IntoProto thanks to the blanket implementation in the standard library.

Prefer using IntoProto over FromNative when specifying trait bounds on a generic function to ensure that types that only implement IntoProto can be used as well.

§Generic Implementations

Required Methods§

Source

fn into_proto(self) -> P

Performs the conversion.

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, U> IntoProto<U> for T
where U: FromNative<T>,