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
FromNative<T> for UimpliesIntoProto<U> for T
Required Methods§
Sourcefn into_proto(self) -> P
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.