Skip to main content

Encoding

Trait Encoding 

Source
pub trait Encoding: SealedContainer {
    // Provided methods
    fn try_from_items(
        revision: Revision,
        items: Vec<Uitem<Self::Item>>,
    ) -> Result<Self, ParseError> { ... }
    fn decode(s: &str) -> Result<(NetworkType, Revision, Self), ParseError> { ... }
    fn encode(&self, network: &NetworkType) -> String { ... }
}
Expand description

Trait providing common encoding and decoding logic for Unified containers.

Provided Methods§

Source

fn try_from_items( revision: Revision, items: Vec<Uitem<Self::Item>>, ) -> Result<Self, ParseError>

Constructs a value of a unified container type from a vector of items, sorted according to typecode as specified in ZIP 316.

This function will return an error if ZIP 316 invariants are violated.

Source

fn decode(s: &str) -> Result<(NetworkType, Revision, Self), ParseError>

Decodes a unified container from its string representation, preserving the order of its components so that it correctly obeys round-trip serialization invariants.

Source

fn encode(&self, network: &NetworkType) -> String

Encodes the contents of the unified container to its string representation using the correct constants for the specified network, preserving the ordering of the contained items such that it correctly obeys round-trip serialization invariants.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§