[][src]Trait zebra_chain::serialization::ZcashSerialize

pub trait ZcashSerialize: Sized {
    fn zcash_serialize<W: Write>(&self, writer: W) -> Result<(), Error>;

    fn zcash_serialize_to_vec(&self) -> Result<Vec<u8>, Error> { ... }
}

Consensus-critical serialization for Zcash.

This trait provides a generic serialization for consensus-critical formats, such as network messages, transactions, blocks, etc. It is intended for use only in consensus-critical contexts; in other contexts, such as internal storage, it would be preferable to use Serde.

Required methods

fn zcash_serialize<W: Write>(&self, writer: W) -> Result<(), Error>

Write self to the given writer using the canonical format.

This function has a zcash_ prefix to alert the reader that the serialization in use is consensus-critical serialization, rather than some other kind of 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 ZcashSerialize must make illegal states unrepresentable.

Loading content...

Provided methods

fn zcash_serialize_to_vec(&self) -> Result<Vec<u8>, Error>

Helper function to construct a vec to serialize the current struct into

Loading content...

Implementations on Foreign Types

impl ZcashSerialize for PublicKey[src]

impl<T: ZcashSerialize> ZcashSerialize for Vec<T>[src]

impl<T> ZcashSerialize for Arc<T> where
    T: ZcashSerialize
[src]

Loading content...

Implementors

impl ZcashSerialize for TransparentAddress[src]

impl ZcashSerialize for Transaction[src]

impl ZcashSerialize for TransparentInput[src]

impl ZcashSerialize for LockTime[src]

impl ZcashSerialize for SproutShieldedAddress[src]

impl ZcashSerialize for Block[src]

impl ZcashSerialize for BlockHeader[src]

impl ZcashSerialize for BlockHeaderHash[src]

impl ZcashSerialize for EquihashSolution[src]

impl ZcashSerialize for IncomingViewingKey[src]

impl ZcashSerialize for SpendingKey[src]

impl ZcashSerialize for SaplingNoteCommitmentTree[src]

impl ZcashSerialize for zebra_chain::notes::sapling::EncryptedCiphertext[src]

impl ZcashSerialize for OutCiphertext[src]

impl ZcashSerialize for zebra_chain::notes::sprout::EncryptedCiphertext[src]

impl ZcashSerialize for zebra_chain::nullifier::sapling::Nullifier[src]

impl ZcashSerialize for zebra_chain::nullifier::sprout::Nullifier[src]

impl ZcashSerialize for Bctv14Proof[src]

impl ZcashSerialize for Groth16Proof[src]

impl ZcashSerialize for OutPoint[src]

impl ZcashSerialize for Output[src]

impl ZcashSerialize for Spend[src]

impl ZcashSerialize for TransparentOutput[src]

impl ZcashSerialize for MAC[src]

impl ZcashSerialize for Script[src]

impl<P: ZkSnarkProof> ZcashSerialize for JoinSplit<P>[src]

impl<P: ZkSnarkProof> ZcashSerialize for JoinSplitData<P>[src]

Loading content...