Trait fuel_types::canonical::Deserialize

source ·
pub trait Deserialize: Sized {
    // Required method
    fn decode_static<I: Input + ?Sized>(buffer: &mut I) -> Result<Self, Error>;

    // Provided methods
    fn decode<I: Input + ?Sized>(buffer: &mut I) -> Result<Self, Error> { ... }
    fn decode_dynamic<I: Input + ?Sized>(
        &mut self,
        _buffer: &mut I,
    ) -> Result<(), Error> { ... }
    fn from_bytes(buffer: &[u8]) -> Result<Self, Error> { ... }
}
Expand description

Allows deserialize the type from the Input. https://github.com/FuelLabs/fuel-specs/blob/master/specs/protocol/tx_format.md#transaction

Required Methods§

source

fn decode_static<I: Input + ?Sized>(buffer: &mut I) -> Result<Self, Error>

Decodes static part of Self from the buffer.

Provided Methods§

source

fn decode<I: Input + ?Sized>(buffer: &mut I) -> Result<Self, Error>

Decodes Self from the buffer.

It is better to not implement this function directly, instead implement decode_static and decode_dynamic.

source

fn decode_dynamic<I: Input + ?Sized>( &mut self, _buffer: &mut I, ) -> Result<(), Error>

Decodes dynamic part of the information from the buffer to fill Self. The default implementation does nothing. Dynamically-sized contains should override this.

source

fn from_bytes(buffer: &[u8]) -> Result<Self, Error>

Helper method for deserializing Self from bytes.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Deserialize for u8

source§

fn decode_static<I: Input + ?Sized>(buffer: &mut I) -> Result<Self, Error>

source§

impl Deserialize for u16

source§

fn decode_static<I: Input + ?Sized>(buffer: &mut I) -> Result<Self, Error>

source§

impl Deserialize for u32

source§

fn decode_static<I: Input + ?Sized>(buffer: &mut I) -> Result<Self, Error>

source§

impl Deserialize for u64

source§

fn decode_static<I: Input + ?Sized>(buffer: &mut I) -> Result<Self, Error>

source§

impl Deserialize for u128

source§

fn decode_static<I: Input + ?Sized>(buffer: &mut I) -> Result<Self, Error>

source§

impl Deserialize for ()

source§

fn decode_static<I: Input + ?Sized>(_buffer: &mut I) -> Result<Self, Error>

source§

impl Deserialize for usize

source§

fn decode_static<I: Input + ?Sized>(buffer: &mut I) -> Result<Self, Error>

source§

impl<T: Deserialize> Deserialize for Vec<T>

source§

fn decode_static<I: Input + ?Sized>(buffer: &mut I) -> Result<Self, Error>

source§

fn decode_dynamic<I: Input + ?Sized>( &mut self, buffer: &mut I, ) -> Result<(), Error>

source§

impl<const N: usize, T: Deserialize> Deserialize for [T; N]

source§

fn decode_static<I: Input + ?Sized>(buffer: &mut I) -> Result<Self, Error>

source§

fn decode_dynamic<I: Input + ?Sized>( &mut self, buffer: &mut I, ) -> Result<(), Error>

Implementors§