pub trait FromNative<N>: Sized {
// Required method
fn from_native(value: N) -> Self;
}Expand description
Used to do value-to-value conversions while consuming the input value. It is the reciprocal of
IntoProto.
One should always prefer implementing FromNative over IntoProto
because implementing FromNative automatically provides one with an implementation of IntoProto
thanks to the blanket implementation in this crate.
This can’t failed because every prost type is just a subset of the native one.
§Generic Implementations
FromNative<T> for UimpliesIntoProto<U> for T
You should probabily use the derive macro to impl FromNative<P>
Required Methods§
Sourcefn from_native(value: N) -> Self
fn from_native(value: N) -> Self
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.