#[repr(u8)]pub enum Tag {
Show 33 variants
False = 0,
True = 1,
Void = 2,
Error = 3,
U32Val = 4,
I32Val = 5,
U64Small = 6,
I64Small = 7,
TimepointSmall = 8,
DurationSmall = 9,
U128Small = 10,
I128Small = 11,
U256Small = 12,
I256Small = 13,
SymbolSmall = 14,
SmallCodeUpperBound = 15,
ObjectCodeLowerBound = 63,
U64Object = 64,
I64Object = 65,
TimepointObject = 66,
DurationObject = 67,
U128Object = 68,
I128Object = 69,
U256Object = 70,
I256Object = 71,
BytesObject = 72,
StringObject = 73,
SymbolObject = 74,
VecObject = 75,
MapObject = 76,
AddressObject = 77,
ObjectCodeUpperBound = 78,
Bad = 127,
}
Expand description
Code values for the 8 tag
bits in the bit-packed representation
of Val. These don’t coincide with tag numbers in the SCVal XDR
but cover all those cases as well as some optimized refinements for
special cases (boolean true and false, small-value forms).
Variants§
False = 0
Tag for a Val that encodes bool false
. The bool type is refined to
two single-value subtypes in order for each tag number to coincide with
the WASM encoding of a boolean.
True = 1
Void = 2
Tag for a Val that is empty/absent (eg. void, null, nil, undefined, None)
Error = 3
Tag for a Val that is contains an error code.
U32Val = 4
I32Val = 5
U64Small = 6
I64Small = 7
TimepointSmall = 8
DurationSmall = 9
U128Small = 10
I128Small = 11
U256Small = 12
I256Small = 13
SymbolSmall = 14
Tag for a Val that contains up to 9 character symbols.
SmallCodeUpperBound = 15
Code delimiting the upper boundary of “small” types.
ObjectCodeLowerBound = 63
Tag reserved to indicate boundary between tags for “small” types with their payload packed into the remaining 56 bits of the Val and “object” types that are stored as host objects and referenced by Object handle.
U64Object = 64
I64Object = 65
TimepointObject = 66
Tag for a Val that refers to a host-side u64 number encoding a time-point (a count of seconds since the Unix epoch, Jan 1 1970 UTC).
DurationObject = 67
U128Object = 68
I128Object = 69
U256Object = 70
I256Object = 71
BytesObject = 72
Tag for a Val that refers to a host-side byte array.
StringObject = 73
Tag for a Val that refers to a host-side string.
SymbolObject = 74
VecObject = 75
MapObject = 76
AddressObject = 77
Tag for a Val that refers to a host-side contract address.
ObjectCodeUpperBound = 78
Code delimiting the upper boundary of “object” types.
Bad = 127
Code reserved to indicate mis-tagged Val
s.
Implementations§
Source§impl Tag
impl Tag
pub const fn val_mask() -> i64
pub fn val_const(&self) -> i64
pub const fn is_object(self) -> bool
pub const fn from_u8(tag: u8) -> Tag
Sourcepub const fn get_scval_type(&self) -> Option<ScValType>
pub const fn get_scval_type(&self) -> Option<ScValType>
Get the ScValType of the XDR type that corresponds to this tag.
For use in the Host::obj_cmp
comparison function so that comparison
based on tags can be done identically to the ScVal
type.
Returns None
for Tag::Bad
, and for the three marker tags
SmallCodeUpperBound
, ObjectCodeLowerBound
, ObjectCodeUpperBound
.
Trait Implementations§
Source§impl Ord for Tag
impl Ord for Tag
Source§impl PartialOrd for Tag
impl PartialOrd for Tag
impl Copy for Tag
impl Eq for Tag
impl StructuralPartialEq for Tag
Auto Trait Implementations§
impl Freeze for Tag
impl RefUnwindSafe for Tag
impl Send for Tag
impl Sync for Tag
impl Unpin for Tag
impl UnwindSafe for Tag
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§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T, U, V, W, E, C> Compare<(T, U, V, W)> for C
impl<T, U, V, W, E, C> Compare<(T, U, V, W)> for C
type Error = E
fn compare( &self, a: &(T, U, V, W), b: &(T, U, V, W), ) -> Result<Ordering, <C as Compare<(T, U, V, W)>>::Error>
Source§impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for C
impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for C
type Error = E
fn compare( &self, a: &(T, U, V, W, X), b: &(T, U, V, W, X), ) -> Result<Ordering, <C as Compare<(T, U, V, W, X)>>::Error>
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
key
and return true
if they are equal.