[][src]Trait ergo_lib::serialization::SigmaSerializable

pub trait SigmaSerializable: Sized {
    pub fn sigma_serialize<W: SigmaByteWrite>(
        &self,
        w: &mut W
    ) -> Result<(), Error>;
pub fn sigma_parse<R: SigmaByteRead>(
        r: &mut R
    ) -> Result<Self, SerializationError>; pub fn sigma_serialize_bytes(&self) -> Vec<u8> { ... }
pub fn sigma_parse_bytes(
        mut bytes: Vec<u8>
    ) -> Result<Self, SerializationError> { ... } }

Consensus-critical serialization for Ergo

Required methods

pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]

Write self to the given writer. This function has a sigma_ prefix to alert the reader that the serialization in use is consensus-critical serialization
Notice that the error type is std::io::Error; this indicates that serialization MUST be infallible up to errors in the underlying writer. In other words, any type implementing SigmaSerializable must make illegal states unrepresentable.

pub fn sigma_parse<R: SigmaByteRead>(
    r: &mut R
) -> Result<Self, SerializationError>
[src]

Try to read self from the given reader. sigma- prefix to alert the reader that the serialization in use is consensus-critical

Loading content...

Provided methods

pub fn sigma_serialize_bytes(&self) -> Vec<u8>[src]

Serialize any SigmaSerializable value into bytes

pub fn sigma_parse_bytes(mut bytes: Vec<u8>) -> Result<Self, SerializationError>[src]

Parse self from the bytes

Loading content...

Implementors

impl SigmaSerializable for RegisterId[src]

impl SigmaSerializable for ProofBytes[src]

impl SigmaSerializable for SigmaBoolean[src]

impl SigmaSerializable for SType[src]

Each SType is serialized to array of bytes by:

  • emitting typeCode of each node (see special case for collections below)
  • then recursively serializing subtrees from left to right on each level
  • for each collection of primitive type there is special type code to emit single byte instead of two bytes Types code intervals
  • (1 .. MaxPrimTypeCode) // primitive types
  • (CollectionTypeCode .. CollectionTypeCode + MaxPrimTypeCode) // collections of primitive types
  • (MaxCollectionTypeCode ..) // Other types Collection of non-primitive type is serialized as (CollectionTypeCode, serialize(elementType))

impl SigmaSerializable for Constant[src]

impl SigmaSerializable for BoxId[src]

impl SigmaSerializable for BoxValue[src]

impl SigmaSerializable for ErgoBox[src]

impl SigmaSerializable for ErgoBoxCandidate[src]

impl SigmaSerializable for Digest32[src]

impl SigmaSerializable for TokenId[src]

impl SigmaSerializable for DataInput[src]

impl SigmaSerializable for Input[src]

impl SigmaSerializable for Transaction[src]

impl SigmaSerializable for TxId[src]

impl SigmaSerializable for ErgoTree[src]

impl SigmaSerializable for EcPoint[src]

impl SigmaSerializable for ContextExtension[src]

impl SigmaSerializable for ProverResult[src]

impl SigmaSerializable for ProveDlog[src]

Loading content...