Enum AbiType

Source
pub enum AbiType {
Show 17 variants Uint(u16), Int(u16), VarUint(NonZeroU8), VarInt(NonZeroU8), Bool, Cell, Address, Bytes, FixedBytes(usize), String, Token, Tuple(Arc<[NamedAbiType]>), Array(Arc<Self>), FixedArray(Arc<Self>, usize), Map(PlainAbiType, Arc<Self>), Optional(Arc<Self>), Ref(Arc<Self>),
}
Expand description

ABI value type.

Variants§

§

Uint(u16)

Unsigned integer of n bits.

§

Int(u16)

Signed integer of n bits.

§

VarUint(NonZeroU8)

Variable-length unsigned integer of maximum n bytes.

§

VarInt(NonZeroU8)

Variable-length signed integer of maximum n bytes.

§

Bool

Boolean.

§

Cell

Tree of cells (Cell).

§

Address

Internal address (IntAddr).

§

Bytes

Byte array.

§

FixedBytes(usize)

Byte array of fixed length.

§

String

Utf8-encoded string.

§

Token

Variable length 120-bit integer (Tokens).

§

Tuple(Arc<[NamedAbiType]>)

Product type.

§

Array(Arc<Self>)

Array of elements of the specified ABI type.

§

FixedArray(Arc<Self>, usize)

Fixed-length array of elements of the specified ABI type.

§

Map(PlainAbiType, Arc<Self>)

Dictionary with the specified key and value ABI types.

§

Optional(Arc<Self>)

Optional type.

§

Ref(Arc<Self>)

Type stored in a new cell.

Implementations§

Source§

impl AbiType

Source

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

Returns a named ABI type.

Source

pub fn as_plain(&self) -> Option<PlainAbiType>

Tries to convert a generic ABI type into a plain ABI type.

Source

pub fn max_size(&self) -> CellTreeStats

Returns the maximum number of bits and refs that this type can occupy.

Source

pub fn max_bits(&self) -> usize

Returns the maximum number of bits that this type can occupy.

Source

pub fn max_refs(&self) -> usize

Returns the maximum number of cells that this type can occupy.

Source

pub fn flatten(self) -> AbiTypeFlatten

Returns an iterator with the first-level tuple flattened.

Can be used to pass an ABI struct as arguments to the FunctionBuilder::with_unnamed_inputs or FunctionBuilder::with_unnamed_outputs

Source

pub fn varuint(size: u8) -> Self

Simple varuintN type constructor.

Source

pub fn varint(size: u8) -> Self

Simple varintN type constructor.

Source

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

Simple tuple type constructor.

Source

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

Simple tuple type constructor.

Source

pub fn array<T>(ty: T) -> Self
where Arc<AbiType>: From<T>,

Simple array type constructor.

Source

pub fn fixedarray<T>(ty: T, len: usize) -> Self
where Arc<AbiType>: From<T>,

Simple fixedarrayN type constructor.

Source

pub fn map<V>(key_ty: PlainAbiType, value_ty: V) -> Self
where Arc<AbiType>: From<V>,

Simple tuple type constructor.

Source

pub fn optional<T>(ty: T) -> Self
where Arc<AbiType>: From<T>,

Simple optional type constructor.

Source

pub fn reference<T>(ty: T) -> Self
where Arc<AbiType>: From<T>,

Simple ref type constructor.

Source§

impl AbiType

Source

pub fn make_default_value(&self) -> AbiValue

Returns a default value corresponding to the this type.

Trait Implementations§

Source§

impl AsRef<AbiType> for AbiType

Source§

fn as_ref(&self) -> &AbiType

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<AbiType> for NamedAbiType

Source§

fn as_ref(&self) -> &AbiType

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for AbiType

Source§

fn clone(&self) -> AbiType

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for AbiType

Source§

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

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

impl Display for AbiType

Source§

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

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

impl From<PlainAbiType> for AbiType

Source§

fn from(value: PlainAbiType) -> Self

Converts to this type from the input type.
Source§

impl Hash for AbiType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IgnoreName for AbiType

Source§

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

Wrapped ABI entity.
Source§

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

Wraps an ABI entity into WithoutName.
Source§

impl PartialEq for AbiType

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const 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 Eq for AbiType

Source§

impl StructuralPartialEq for AbiType

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<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> 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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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<T> EquivalentRepr<T> for T