Skip to main content

TransactionOutput

Struct TransactionOutput 

Source
pub struct TransactionOutput(/* private fields */);
Expand description

The type of transaction output could be either #[output] or return value, with the index of the declared output that it writes.

A payload declares its outputs upfront, each with a capacity, and every #[output] and return value of a method writes one of them, which later methods can refer to, see TransactionInput. Several methods can write the same declared output one after another, and each of them replaces the value. A method writes a declared output at most once, and its slots and inputs don’t refer to a declared output that it writes. The memory of every declared output is aligned to [Alignment::MAX], the largest alignment of any type that methods accept, so it is aligned for every output type.

#[output] is given to the method empty, whatever the memory held before, and has the size the method wrote into it. The return value doesn’t have a size in ExternalArgs, executors only write the value, so the payload declares its size, which is the size of its type and must not exceed the capacity of the declared output.

Implementations§

Source§

impl TransactionOutput

Source

pub const fn new_output(output_index: u8) -> Option<Self>

#[output] that writes the declared output with output_index.

Valid index values are below MAX_OUTPUTS.

Source

pub const fn new_return_value(output_index: u8) -> Option<Self>

Return value that is written into the declared output with output_index.

Valid index values are below MAX_OUTPUTS.

Source

pub const fn from_u8(n: u8) -> Option<Self>

Create an instance from u8.

Returns None for bytes that Self::into_u8() never returns, so each output has one encoding.

Source

pub const fn into_u8(self) -> u8

Convert instance into u8

Source

pub const fn output_type(self) -> TransactionOutputType

Returns whether this is #[output] or return value, with the index of its declared output

Trait Implementations§

Source§

impl Clone for TransactionOutput

Source§

fn clone(&self) -> TransactionOutput

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TransactionOutput

Source§

impl Debug for TransactionOutput

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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>,

Source§

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.