pub struct ExternReturnValue { /* private fields */ }
Expand description

A type representing the return value of contract init or receive method. The intention is that this type is manipulated using methods of the Write trait. In particular it can be used as a sink to serialize values into.

Typically referred to via the alias ReturnValue.

Implementations§

source§

impl ExternReturnValue

source

pub fn open() -> Self

Create a return value cursor that starts at the beginning. Note that there is a single return value per contract invocation, so multiple calls to open will give access to writing the same return value. Thus this function should only be used once per contract invocation.

Trait Implementations§

source§

impl Write for ExternReturnValue

Return values are intended to be produced by writing to the ExternReturnValue buffer, either in a high-level interface via serialization, or in a low-level interface by manually using the Write trait’s interface.

§

type Err = ()

source§

fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Err>

Try to write the given buffer into the output stream. If writes are successful returns the number of bytes written.
source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Err>

Attempt to write the entirety of the buffer to the output by repeatedly calling write until either no more output can written, or writing fails.
source§

fn write_u8(&mut self, x: u8) -> Result<(), Self::Err>

Write a single byte to the output.
source§

fn write_u16(&mut self, x: u16) -> Result<(), Self::Err>

Write a u16 in little endian.
source§

fn write_u32(&mut self, x: u32) -> Result<(), Self::Err>

Write a u32 in little endian.
source§

fn write_u64(&mut self, x: u64) -> Result<(), Self::Err>

Write a u64 in little endian.
source§

fn write_i8(&mut self, x: i8) -> Result<(), Self::Err>

Write a i8 to the output.
source§

fn write_i16(&mut self, x: i16) -> Result<(), Self::Err>

Write a i16 in little endian.
source§

fn write_i32(&mut self, x: i32) -> Result<(), Self::Err>

Write a i32 in little endian.
source§

fn write_i64(&mut self, x: i64) -> Result<(), Self::Err>

Write a i64 in little endian.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.