Trait substrate_stellar_sdk::XdrCodec[][src]

pub trait XdrCodec: Sized {
    fn to_xdr_buffered(&self, write_stream: &mut WriteStream);
fn from_xdr_buffered<T: AsRef<[u8]>>(
        read_stream: &mut ReadStream<T>
    ) -> Result<Self, DecodeError>; fn to_xdr(&self) -> Vec<u8> { ... }
fn from_xdr<T: AsRef<[u8]>>(input: T) -> Result<Self, DecodeError> { ... }
fn to_base64_xdr(&self) -> Vec<u8> { ... }
fn from_base64_xdr<T: AsRef<[u8]>>(input: T) -> Result<Self, DecodeError> { ... } }
Expand description

The XDR decoder/encoder trait

A type that implements this trait can be encoded as XDR or decoded from XDR

Required methods

Encode the XDR to a write stream

This is the basic implementation of the XDR encoder of this type. The methods to_xdr and to_base64_xdr call this function to do the heavy lifting.

Decode the XDR from a read stream

This is the basic implementation of the XDR decoder of this type. The methods from_xdr and from_base64_xdr call this function to do the heavy lifting.

Provided methods

Encode this type as XDR

The binary XDR is returned as a byte vector

Decode XDR provided as a reference to a byte vector

This will return error if decoding was not successful

Encode this type as base64 encoded XDR

This returns an ASCII string (as a byte vector) that is the base64 encoding of the XDR encoding of this type.

Decode this type from base64 encoded XDR

This takes a reference to an ASCII string (as a byte vector), decodes it as base64 and then decodes the resulting binary array as XDR.

Implementations on Foreign Types

Implementation of the XDR decoder/encoder for u64

Implementation of the XDR decoder/encoder for i64

Implementation of the XDR decoder/encoder for u32

Implementation of the XDR decoder/encoder for i32

Implementation of the XDR decoder/encoder for bool

Implementation of the XDR decoder/encoder for a fixed size array

This requires that the inner type already implements XdrCodec

Implementation of the XDR decoder/encoder for fixed length binary data

Implementation of the XDR decoder/encoder for an Option.

This requires that the inner type already implements XdrCodec

Implementation of the XDR decoder/encoder for an Box.

This requires that the inner type already implements XdrCodec

Implementors