[−][src]Trait ergo_lib::serialization::SigmaSerializable
Consensus-critical serialization for Ergo
Required methods
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>
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>
r: &mut R
) -> Result<Self, SerializationError>
Try to read self from the given reader.
sigma- prefix to alert the reader that the serialization in use
is consensus-critical
Provided methods
pub fn sigma_serialize_bytes(&self) -> Vec<u8>
Serialize any SigmaSerializable value into bytes
pub fn sigma_parse_bytes(bytes: Vec<u8>) -> Result<Self, SerializationError>
Parse self from the bytes
Implementors
impl SigmaSerializable for ProofBytes[src]
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for SigmaBoolean[src]
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
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))
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for Constant[src]
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for BoxId[src]
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for BoxValue[src]
pub fn sigma_serialize<W: WriteSigmaVlqExt>(
&self,
w: &mut W
) -> Result<(), Error>[src]
&self,
w: &mut W
) -> Result<(), Error>
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for ErgoBox[src]
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for ErgoBoxCandidate[src]
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for Digest32[src]
pub fn sigma_serialize<W: WriteSigmaVlqExt>(
&self,
w: &mut W
) -> Result<(), Error>[src]
&self,
w: &mut W
) -> Result<(), Error>
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for TokenId[src]
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for DataInput[src]
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for Input[src]
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for Transaction[src]
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for TxId[src]
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for ErgoTree[src]
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
pub fn sigma_parse_bytes(bytes: Vec<u8>) -> Result<Self, SerializationError>[src]
impl SigmaSerializable for EcPoint[src]
pub fn sigma_serialize<W: WriteSigmaVlqExt>(
&self,
w: &mut W
) -> Result<(), Error>[src]
&self,
w: &mut W
) -> Result<(), Error>
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for ContextExtension[src]
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for ProverResult[src]
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>
impl SigmaSerializable for ProveDlog[src]
pub fn sigma_serialize<W: SigmaByteWrite>(&self, w: &mut W) -> Result<(), Error>[src]
pub fn sigma_parse<R: SigmaByteRead>(
r: &mut R
) -> Result<Self, SerializationError>[src]
r: &mut R
) -> Result<Self, SerializationError>