pub trait AnyConvertible: Sized {
// Required methods
fn to_any(&self) -> Result<Any, ExtensionError>;
fn from_any<'a>(any: AnyRef<'a>) -> Result<Self, ExtensionError>;
fn type_url() -> String;
}Expand description
Trait for types that can be converted to/from protobuf Any messages. Note that this is already implemented for all prost::Message types. For custom types, implement this trait.
Required Methods§
Sourcefn to_any(&self) -> Result<Any, ExtensionError>
fn to_any(&self) -> Result<Any, ExtensionError>
Convert this type to a protobuf Any message
Sourcefn from_any<'a>(any: AnyRef<'a>) -> Result<Self, ExtensionError>
fn from_any<'a>(any: AnyRef<'a>) -> Result<Self, ExtensionError>
Convert from a protobuf Any message to this type
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.