pub trait TryFromProto<P>: Sized {
// Required method
fn try_from_proto(value: P) -> Result<Self, ProstConvertError>;
}Expand description
Simple and safe type conversions that may fail in a controlled
way under some circumstances. It is the reciprocal of TryIntoNative.
This is useful when you are doing a type conversion that may
trivially succeed but may also need special handling.
For example, the proto struct may have an Option field that is required
in the native side.
§Generic Implementations
TryFromProto<T> for UimpliesTryIntoNative<U> for T
You should probabily use the derive macro to impl TryFromProto<P>
Required Methods§
Sourcefn try_from_proto(value: P) -> Result<Self, ProstConvertError>
fn try_from_proto(value: P) -> Result<Self, ProstConvertError>
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.