Skip to main content

AbiValue

Enum AbiValue 

Source
pub enum AbiValue {
Show 17 variants Uint(u16, BigUint), Int(u16, BigInt), VarUint(NonZeroU8, BigUint), VarInt(NonZeroU8, BigInt), Bool(bool), Cell(Cell), Address(Box<IntAddr>), Bytes(Bytes), FixedBytes(Bytes), String(String), Token(Tokens), Tuple(Vec<NamedAbiValue>), Array(Arc<AbiType>, Vec<Self>), FixedArray(Arc<AbiType>, Vec<Self>), Map(PlainAbiType, Arc<AbiType>, BTreeMap<PlainAbiValue, AbiValue>), Optional(Arc<AbiType>, Option<Box<Self>>), Ref(Box<Self>),
}
Expand description

ABI encoded value.

Variants§

§

Uint(u16, BigUint)

Unsigned integer of n bits.

§

Int(u16, BigInt)

Signed integer of n bits.

§

VarUint(NonZeroU8, BigUint)

Variable-length unsigned integer of maximum n bytes.

§

VarInt(NonZeroU8, BigInt)

Variable-length signed integer of maximum n bytes.

§

Bool(bool)

Boolean.

§

Cell(Cell)

Tree of cells (Cell).

§

Address(Box<IntAddr>)

Internal address (IntAddr).

§

Bytes(Bytes)

Byte array.

§

FixedBytes(Bytes)

Byte array of fixed length.

§

String(String)

Utf8-encoded string.

§

Token(Tokens)

Variable length 120-bit integer (Tokens).

§

Tuple(Vec<NamedAbiValue>)

Product type.

§

Array(Arc<AbiType>, Vec<Self>)

Array of ABI values.

§

FixedArray(Arc<AbiType>, Vec<Self>)

Fixed-length array of ABI values.

§

Map(PlainAbiType, Arc<AbiType>, BTreeMap<PlainAbiValue, AbiValue>)

Sorted dictionary of ABI values.

§

Optional(Arc<AbiType>, Option<Box<Self>>)

Optional value.

§

Ref(Box<Self>)

Value stored in a new cell.

Implementations§

Source§

impl AbiValue

Source

pub fn check_remaining( slice: &mut CellSlice<'_>, allow_partial: bool, ) -> Result<()>

Checks whether the slice is empty and raises an error if we didn’t expect it to be empty.

Source

pub fn load_tuple( types: &[AbiType], version: AbiVersion, slice: &mut CellSlice<'_>, ) -> Result<Vec<Self>>

Loads exactly one unnamed tuple from the specified slice requiring it to be fully consumed.

Use AbiValue::load_tuple_partial if you allow an ABI type to be a prefix.

Source

pub fn load_tuple_partial( types: &[AbiType], version: AbiVersion, slice: &mut CellSlice<'_>, ) -> Result<Vec<Self>>

Loads an unnamed tuple from the specified slice.

Source

pub fn load_tuple_ext( types: &[AbiType], version: AbiVersion, last: bool, allow_partial: bool, slice: &mut CellSlice<'_>, ) -> Result<Vec<Self>>

Loads an unnamed tuple from the specified slice with explicit decoder params.

NOTE: this method does not check the remaining bits and refs in the root slice.

Source

pub fn load( ty: &AbiType, version: AbiVersion, slice: &mut CellSlice<'_>, ) -> Result<Self>

Loads exactly one ABI value from the specified slice requiring it to be fully consumed.

Use AbiValue::load_partial if you allow an ABI type to be a prefix.

Source

pub fn load_partial( ty: &AbiType, version: AbiVersion, slice: &mut CellSlice<'_>, ) -> Result<Self>

Loads an ABI value from the specified slice.

Source

pub fn load_ext( ty: &AbiType, version: AbiVersion, last: bool, allow_partial: bool, slice: &mut CellSlice<'_>, ) -> Result<Self>

Loads an ABI value from the specified slice with explicit decoder params.

NOTE: this method does not check the remaining bits and refs in the root slice.

Source§

impl AbiValue

Source

pub fn tuple_to_builder( values: &[Self], version: AbiVersion, ) -> Result<CellBuilder, Error>

Tries to store multiple values into a new builder according to the specified ABI version.

Source

pub fn tuple_to_cell( values: &[Self], version: AbiVersion, ) -> Result<Cell, Error>

Builds a new cell from multiple values according to the specified ABI version.

Source

pub fn make_builder(&self, version: AbiVersion) -> Result<CellBuilder, Error>

Tries to store this value into a new builder according to the specified ABI version.

Source

pub fn make_cell(&self, version: AbiVersion) -> Result<Cell, Error>

Builds a new cell from this value according to the specified ABI version.

Source§

impl AbiValue

Source

pub fn named<T: Into<String>>(self, name: T) -> NamedAbiValue

Returns a named ABI value.

Source

pub fn check_type<T: AsRef<AbiType>>(&self, ty: T) -> Result<()>

Ensures that value satisfies the type.

Source

pub fn has_type(&self, ty: &AbiType) -> bool

Returns whether this value has the same type as the provided one.

Source

pub fn get_type(&self) -> AbiType

Returns an ABI type of the value.

Source

pub fn display_type(&self) -> impl Display + '_

Returns a printable object which will display a value type signature.

Source

pub fn uint<T>(bits: u16, value: T) -> Self
where BigUint: From<T>,

Simple uintN constructor.

Source

pub fn int<T>(bits: u16, value: T) -> Self
where BigInt: From<T>,

Simple intN constructor.

Source

pub fn varuint<T>(size: u8, value: T) -> Self
where BigUint: From<T>,

Simple varuintN constructor.

Source

pub fn varint<T>(size: u8, value: T) -> Self
where BigInt: From<T>,

Simple varintN constructor.

Source

pub fn address<T>(value: T) -> Self
where IntAddr: From<T>,

Simple address constructor.

Source

pub fn bytes<T>(value: T) -> Self
where Bytes: From<T>,

Simple bytes constructor.

Source

pub fn fixedbytes<T>(value: T) -> Self
where Bytes: From<T>,

Simple bytes constructor.

Source

pub fn tuple<I, T>(values: I) -> Self
where I: IntoIterator<Item = T>, NamedAbiValue: From<T>,

Simple tuple constructor.

Source

pub fn unnamed_tuple<I>(values: I) -> Self
where I: IntoIterator<Item = AbiValue>,

Simple tuple constructor.

Source

pub fn array<T, I>(values: I) -> Self
where T: WithAbiType + IntoAbi, I: IntoIterator<Item = T>,

Simple array constructor.

Source

pub fn fixedarray<T, I>(values: I) -> Self
where T: WithAbiType + IntoAbi, I: IntoIterator<Item = T>,

Simple fixedarray constructor.

Source

pub fn map<K, V, I>(entries: I) -> Self

Simple map constructor.

Source

pub fn optional<T>(value: Option<T>) -> Self
where T: WithAbiType + IntoAbi,

Simple optional constructor.

Source

pub fn reference<T>(value: T) -> Self
where T: IntoAbi,

Simple optional constructor.

Trait Implementations§

Source§

impl Clone for AbiValue

Source§

fn clone(&self) -> AbiValue

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 Debug for AbiValue

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for AbiValue

Source§

impl From<PlainAbiValue> for AbiValue

Source§

fn from(value: PlainAbiValue) -> Self

Converts to this type from the input type.
Source§

impl FromAbi for AbiValue

Source§

fn from_abi(value: AbiValue) -> Result<Self>

Constructs self from the ABI value.
Source§

impl IgnoreName for AbiValue

Source§

type Unnamed<'a> = &'a WithoutName<AbiValue>

Wrapped ABI entity.
Source§

fn ignore_name(&self) -> Self::Unnamed<'_>

Wraps an ABI entity into WithoutName.
Source§

impl IntoAbi for AbiValue

Source§

fn as_abi(&self) -> AbiValue

Returns a corresponding ABI value. Read more
Source§

fn into_abi(self) -> AbiValue
where Self: Sized,

Converts into a corresponding ABI value.
Source§

impl PartialEq for AbiValue

Source§

fn eq(&self, other: &AbiValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for AbiValue

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compares self to key and returns true if they are equal.
Source§

impl<T> EquivalentRepr<T> for T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V