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
impl AbiValue
Sourcepub fn check_remaining(
slice: &mut CellSlice<'_>,
allow_partial: bool,
) -> Result<()>
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.
Sourcepub fn load_tuple(
types: &[AbiType],
version: AbiVersion,
slice: &mut CellSlice<'_>,
) -> Result<Vec<Self>>
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.
Sourcepub fn load_tuple_partial(
types: &[AbiType],
version: AbiVersion,
slice: &mut CellSlice<'_>,
) -> Result<Vec<Self>>
pub fn load_tuple_partial( types: &[AbiType], version: AbiVersion, slice: &mut CellSlice<'_>, ) -> Result<Vec<Self>>
Loads an unnamed tuple from the specified slice.
Sourcepub fn load_tuple_ext(
types: &[AbiType],
version: AbiVersion,
last: bool,
allow_partial: bool,
slice: &mut CellSlice<'_>,
) -> Result<Vec<Self>>
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.
Sourcepub fn load(
ty: &AbiType,
version: AbiVersion,
slice: &mut CellSlice<'_>,
) -> Result<Self>
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.
Sourcepub fn load_partial(
ty: &AbiType,
version: AbiVersion,
slice: &mut CellSlice<'_>,
) -> Result<Self>
pub fn load_partial( ty: &AbiType, version: AbiVersion, slice: &mut CellSlice<'_>, ) -> Result<Self>
Loads an ABI value from the specified slice.
Source§impl AbiValue
impl AbiValue
Sourcepub fn tuple_to_builder(
values: &[Self],
version: AbiVersion,
) -> Result<CellBuilder, Error>
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.
Sourcepub fn tuple_to_cell(
values: &[Self],
version: AbiVersion,
) -> Result<Cell, Error>
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.
Sourcepub fn make_builder(&self, version: AbiVersion) -> Result<CellBuilder, Error>
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§impl AbiValue
impl AbiValue
Sourcepub fn named<T: Into<String>>(self, name: T) -> NamedAbiValue
pub fn named<T: Into<String>>(self, name: T) -> NamedAbiValue
Returns a named ABI value.
Sourcepub fn check_type<T: AsRef<AbiType>>(&self, ty: T) -> Result<()>
pub fn check_type<T: AsRef<AbiType>>(&self, ty: T) -> Result<()>
Ensures that value satisfies the type.
Sourcepub fn has_type(&self, ty: &AbiType) -> bool
pub fn has_type(&self, ty: &AbiType) -> bool
Returns whether this value has the same type as the provided one.
Sourcepub fn display_type(&self) -> impl Display + '_
pub fn display_type(&self) -> impl Display + '_
Returns a printable object which will display a value type signature.
Sourcepub fn fixedbytes<T>(value: T) -> Self
pub fn fixedbytes<T>(value: T) -> Self
Simple bytes constructor.
Sourcepub fn unnamed_tuple<I>(values: I) -> Selfwhere
I: IntoIterator<Item = AbiValue>,
pub fn unnamed_tuple<I>(values: I) -> Selfwhere
I: IntoIterator<Item = AbiValue>,
Simple tuple constructor.
Sourcepub fn fixedarray<T, I>(values: I) -> Self
pub fn fixedarray<T, I>(values: I) -> Self
Simple fixedarray constructor.
Sourcepub fn optional<T>(value: Option<T>) -> Selfwhere
T: WithAbiType + IntoAbi,
pub fn optional<T>(value: Option<T>) -> Selfwhere
T: WithAbiType + IntoAbi,
Simple optional constructor.
Trait Implementations§
Source§impl From<PlainAbiValue> for AbiValue
impl From<PlainAbiValue> for AbiValue
Source§fn from(value: PlainAbiValue) -> Self
fn from(value: PlainAbiValue) -> Self
Source§impl IgnoreName for AbiValue
impl IgnoreName for AbiValue
Source§type Unnamed<'a> = &'a WithoutName<AbiValue>
type Unnamed<'a> = &'a WithoutName<AbiValue>
Source§fn ignore_name(&self) -> Self::Unnamed<'_>
fn ignore_name(&self) -> Self::Unnamed<'_>
WithoutName.impl Eq for AbiValue
impl StructuralPartialEq for AbiValue
Auto Trait Implementations§
impl !Freeze for AbiValue
impl !RefUnwindSafe for AbiValue
impl Send for AbiValue
impl Sync for AbiValue
impl Unpin for AbiValue
impl !UnwindSafe for AbiValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
self to key and returns true if they are equal.