pub trait DocumentPlatformConversionMethodsV0: Clone {
// Required methods
fn serialize(
&self,
document_type: DocumentTypeRef<'_>,
data_contract: &DataContract,
platform_version: &PlatformVersion,
) -> Result<Vec<u8>, ProtocolError>;
fn serialize_specific_version(
&self,
document_type: DocumentTypeRef<'_>,
data_contract: &DataContract,
feature_version: FeatureVersion,
) -> Result<Vec<u8>, ProtocolError>;
fn from_bytes(
serialized_document: &[u8],
document_type: DocumentTypeRef<'_>,
platform_version: &PlatformVersion,
) -> Result<Self, ProtocolError>
where Self: Sized;
fn from_bytes_in_consensus(
serialized_document: &[u8],
document_type: DocumentTypeRef<'_>,
platform_version: &PlatformVersion,
) -> Result<ConsensusValidationResult<Self>, ProtocolError>
where Self: Sized;
}Required Methods§
Sourcefn serialize(
&self,
document_type: DocumentTypeRef<'_>,
data_contract: &DataContract,
platform_version: &PlatformVersion,
) -> Result<Vec<u8>, ProtocolError>
fn serialize( &self, document_type: DocumentTypeRef<'_>, data_contract: &DataContract, platform_version: &PlatformVersion, ) -> Result<Vec<u8>, ProtocolError>
Serializes the document.
The serialization of a document follows the pattern: id 32 bytes + owner_id 32 bytes + encoded values byte arrays
Sourcefn serialize_specific_version(
&self,
document_type: DocumentTypeRef<'_>,
data_contract: &DataContract,
feature_version: FeatureVersion,
) -> Result<Vec<u8>, ProtocolError>
fn serialize_specific_version( &self, document_type: DocumentTypeRef<'_>, data_contract: &DataContract, feature_version: FeatureVersion, ) -> Result<Vec<u8>, ProtocolError>
Serializes the document.
The serialization of a document follows the pattern: id 32 bytes + owner_id 32 bytes + encoded values byte arrays
Sourcefn from_bytes(
serialized_document: &[u8],
document_type: DocumentTypeRef<'_>,
platform_version: &PlatformVersion,
) -> Result<Self, ProtocolError>where
Self: Sized,
fn from_bytes(
serialized_document: &[u8],
document_type: DocumentTypeRef<'_>,
platform_version: &PlatformVersion,
) -> Result<Self, ProtocolError>where
Self: Sized,
Reads a serialized document and creates a Document from it.
Sourcefn from_bytes_in_consensus(
serialized_document: &[u8],
document_type: DocumentTypeRef<'_>,
platform_version: &PlatformVersion,
) -> Result<ConsensusValidationResult<Self>, ProtocolError>where
Self: Sized,
fn from_bytes_in_consensus(
serialized_document: &[u8],
document_type: DocumentTypeRef<'_>,
platform_version: &PlatformVersion,
) -> Result<ConsensusValidationResult<Self>, ProtocolError>where
Self: Sized,
Reads a serialized document and creates a Document from it. This will return a ConsensusValidationResult instead when the error is happening in consensus (deserialization of a message from the network)
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.