pub enum SignatureToken {
Bool,
U8,
U64,
U128,
Address,
Signer,
Vector(Box<SignatureToken>),
Struct(StructHandleIndex),
StructInstantiation(StructHandleIndex, Vec<SignatureToken>),
Reference(Box<SignatureToken>),
MutableReference(Box<SignatureToken>),
TypeParameter(TypeParameterIndex),
}
Expand description
A SignatureToken
is a type declaration for a location.
Any location in the system has a TypeSignature. A TypeSignature is also used in composed signatures.
A SignatureToken can express more types than the VM can handle safely, and correctness is enforced by the verifier.
Variants§
Bool
Boolean, true
or false
.
U8
Unsigned integers, 8 bits length.
U64
Unsigned integers, 64 bits length.
U128
Unsigned integers, 128 bits length.
Address
Address, a 16 bytes immutable type.
Signer
Signer, a 16 bytes immutable type representing the capability to publish at an address
Vector(Box<SignatureToken>)
Vector
Struct(StructHandleIndex)
User defined type
StructInstantiation(StructHandleIndex, Vec<SignatureToken>)
Reference(Box<SignatureToken>)
Reference to a type.
MutableReference(Box<SignatureToken>)
Mutable reference to a type.
TypeParameter(TypeParameterIndex)
Type parameter.
Implementations§
source§impl SignatureToken
impl SignatureToken
sourcepub fn signature_token_kind(&self) -> SignatureTokenKind
pub fn signature_token_kind(&self) -> SignatureTokenKind
Returns the “value kind” for the SignatureToken
pub fn is_integer(&self) -> bool
sourcepub fn is_reference(&self) -> bool
pub fn is_reference(&self) -> bool
Returns true if the SignatureToken
is any kind of reference (mutable and immutable).
sourcepub fn is_mutable_reference(&self) -> bool
pub fn is_mutable_reference(&self) -> bool
Returns true if the SignatureToken
is a mutable reference.
sourcepub fn is_valid_for_constant(&self) -> bool
pub fn is_valid_for_constant(&self) -> bool
Returns true if the SignatureToken
can represent a constant (as in representable in
the constants table).
sourcepub fn debug_set_sh_idx(&mut self, sh_idx: StructHandleIndex)
pub fn debug_set_sh_idx(&mut self, sh_idx: StructHandleIndex)
Set the index to this one. Useful for random testing.
Panics if this token doesn’t contain a struct handle.
pub fn preorder_traversal(&self) -> SignatureTokenPreorderTraversalIter<'_> ⓘ
pub fn preorder_traversal_with_depth( &self ) -> SignatureTokenPreorderTraversalIterWithDepth<'_> ⓘ
Trait Implementations§
source§impl Arbitrary for SignatureToken
impl Arbitrary for SignatureToken
Arbitrary
for SignatureToken
cannot be derived automatically as it’s a recursive type.
§type Strategy = BoxedStrategy<SignatureToken>
type Strategy = BoxedStrategy<SignatureToken>
Strategy
used to generate values of type Self
.§type Parameters = ()
type Parameters = ()
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.source§fn arbitrary_with(_params: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_params: Self::Parameters) -> Self::Strategy
source§impl Clone for SignatureToken
impl Clone for SignatureToken
source§fn clone(&self) -> SignatureToken
fn clone(&self) -> SignatureToken
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SignatureToken
impl Debug for SignatureToken
source§impl Hash for SignatureToken
impl Hash for SignatureToken
source§impl Ord for SignatureToken
impl Ord for SignatureToken
source§fn cmp(&self, other: &SignatureToken) -> Ordering
fn cmp(&self, other: &SignatureToken) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<SignatureToken> for SignatureToken
impl PartialEq<SignatureToken> for SignatureToken
source§fn eq(&self, other: &SignatureToken) -> bool
fn eq(&self, other: &SignatureToken) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<SignatureToken> for SignatureToken
impl PartialOrd<SignatureToken> for SignatureToken
source§fn partial_cmp(&self, other: &SignatureToken) -> Option<Ordering>
fn partial_cmp(&self, other: &SignatureToken) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more