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
fn to_xdr_buffered(&self, write_stream: &mut WriteStream)
fn to_xdr_buffered(&self, write_stream: &mut WriteStream)
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.
Provided methods
Decode XDR provided as a reference to a byte vector
This will return error if decoding was not successful
fn to_base64_xdr(&self) -> Vec<u8>
fn to_base64_xdr(&self) -> Vec<u8>
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.
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