pub trait Model: Sized {
// Required methods
fn native_model_id() -> u32;
fn native_model_id_str() -> &'static str;
fn native_model_version() -> u32;
fn native_model_version_str() -> &'static str;
fn native_model_decode_body(data: Vec<u8>, id: u32) -> DecodeResult<Self>;
fn native_model_decode_upgrade_body(
data: Vec<u8>,
id: u32,
version: u32,
) -> Result<Self>;
fn native_model_encode_body(&self) -> EncodeResult<Vec<u8>>;
fn native_model_encode_downgrade_body(self, version: u32) -> Result<Vec<u8>>;
// Provided methods
fn native_model_decode(data: Vec<u8>) -> Result<(Self, u32)> { ... }
fn native_model_encode(&self) -> Result<Vec<u8>> { ... }
fn native_model_encode_downgrade(self, version: u32) -> Result<Vec<u8>> { ... }
}Required Methods§
fn native_model_id() -> u32
fn native_model_id_str() -> &'static str
fn native_model_version() -> u32
fn native_model_version_str() -> &'static str
fn native_model_decode_body(data: Vec<u8>, id: u32) -> DecodeResult<Self>
fn native_model_decode_upgrade_body( data: Vec<u8>, id: u32, version: u32, ) -> Result<Self>
fn native_model_encode_body(&self) -> EncodeResult<Vec<u8>>
fn native_model_encode_downgrade_body(self, version: u32) -> Result<Vec<u8>>
Provided Methods§
fn native_model_decode(data: Vec<u8>) -> Result<(Self, u32)>
fn native_model_encode(&self) -> Result<Vec<u8>>
fn native_model_encode_downgrade(self, version: u32) -> Result<Vec<u8>>
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.