#[repr(u8)]
pub enum Tag {
Show 34 variants False, True, Void, Error, U32Val, I32Val, U64Small, I64Small, TimepointSmall, DurationSmall, U128Small, I128Small, U256Small, I256Small, SymbolSmall, LedgerKeyContractInstance, SmallCodeUpperBound, ObjectCodeLowerBound, U64Object, I64Object, TimepointObject, DurationObject, U128Object, I128Object, U256Object, I256Object, BytesObject, StringObject, SymbolObject, VecObject, MapObject, AddressObject, ObjectCodeUpperBound, Bad,
}
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

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 coincides with the WASM encoding of a boolean.

§

True

Tag for a Val that encodes bool true.

§

Void

Tag for a Val that is empty/absent (eg. void, null, nil, undefined, None)

§

Error

Tag for a Val that is contains an error code.

§

U32Val

Tag for a Val that contains a u32 number.

§

I32Val

Tag for a Val that contains an i32 number.

§

U64Small

Tag for a Val that contains a u64 small enough to fit in 56 bits.

§

I64Small

Tag for a Val that contains an i64 small enough to fit in 56 bits.

§

TimepointSmall

Tag for a Val that contains a u64 timepoint small enough to fit in 56 bits.

§

DurationSmall

Tag for a Val that contains a u64 duration small enough to fit in 56 bits.

§

U128Small

Tag for a Val that contains a u128 small enough to fit in 56 bits.

§

I128Small

Tag for a Val that contains a i128 small enough to fit in 56 bits.

§

U256Small

Tag for a Val that contains a [u256] small enough to fit in 56 bits.

§

I256Small

Tag for a Val that contains a [i256] small enough to fit in 56 bits.

§

SymbolSmall

Tag for a Val that contains up to 9 character symbols.

§

LedgerKeyContractInstance

Tag for a Val that corresponds to stellar_xdr::ScVal::LedgerKeyContractInstance

§

SmallCodeUpperBound

Code delimiting the upper boundary of “small” types.

§

ObjectCodeLowerBound

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

Tag for a Val that refers to a host-side u64 number.

§

I64Object

Tag for a Val that refers to a host-side i64 number.

§

TimepointObject

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

Tag for a Val that refers to a host-side i64 number encoding a duration (a count of seconds).

§

U128Object

Tag for a Val that refers to a host-side u128 number.

§

I128Object

Tag for a Val that refers to a host-side i128 number.

§

U256Object

Tag for a Val that refers to a host-side [u256] number.

§

I256Object

Tag for a Val that refers to a host-side [i256] number.

§

BytesObject

§

StringObject

§

SymbolObject

§

VecObject

§

MapObject

§

AddressObject

§

ObjectCodeUpperBound

§

Bad

Implementations§

source§

impl Tag

source

pub const fn rawval_mask() -> i64

source

pub fn rawval_const(&self) -> i64

source

pub const fn is_object(self) -> bool

source

pub const fn from_u8(tag: u8) -> Tag

source

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 Clone for Tag

source§

fn clone(&self) -> Tag

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Tag

source§

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

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

impl Hash for Tag

source§

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

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 Ord for Tag

source§

fn cmp(&self, other: &Tag) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<Tag> for Tag

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Tag> for Tag

source§

fn partial_cmp(&self, other: &Tag) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for Tag

source§

impl Eq for Tag

source§

impl StructuralEq for Tag

source§

impl StructuralPartialEq for Tag

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, C> Compare<&T> for Cwhere C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

source§

fn compare(&self, a: &&T, b: &&T) -> Result<Ordering, <C as Compare<&T>>::Error>

source§

impl<T, U, E, C> Compare<(T, U)> for Cwhere C: Compare<T, Error = E, Error = E> + Compare<U>,

§

type Error = E

source§

fn compare( &self, a: &(T, U), b: &(T, U) ) -> Result<Ordering, <C as Compare<(T, U)>>::Error>

source§

impl<T, U, V, E, C> Compare<(T, U, V)> for Cwhere C: Compare<T, Error = E, Error = E, Error = E> + Compare<U> + Compare<V>,

§

type Error = E

source§

fn compare( &self, a: &(T, U, V), b: &(T, U, V) ) -> Result<Ordering, <C as Compare<(T, U, V)>>::Error>

source§

impl<T, U, V, W, E, C> Compare<(T, U, V, W)> for Cwhere C: Compare<T, Error = E, Error = E, Error = E, Error = E> + Compare<U> + Compare<V> + Compare<W>,

source§

impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for Cwhere C: Compare<T, Error = E, Error = E, Error = E, Error = E, Error = E> + Compare<U> + Compare<V> + Compare<W> + Compare<X>,

source§

impl<T, C> Compare<Box<T, Global>> for Cwhere C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

source§

fn compare( &self, a: &Box<T, Global>, b: &Box<T, Global> ) -> Result<Ordering, <C as Compare<Box<T, Global>>>::Error>

source§

impl<T, C> Compare<Option<T>> for Cwhere C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

source§

fn compare( &self, a: &Option<T>, b: &Option<T> ) -> Result<Ordering, <C as Compare<Option<T>>>::Error>

source§

impl<T, C> Compare<Rc<T, Global>> for Cwhere C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

source§

fn compare( &self, a: &Rc<T, Global>, b: &Rc<T, Global> ) -> Result<Ordering, <C as Compare<Rc<T, Global>>>::Error>

source§

impl<T, C> Compare<Vec<T, Global>> for Cwhere C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

source§

fn compare( &self, a: &Vec<T, Global>, b: &Vec<T, Global> ) -> Result<Ordering, <C as Compare<Vec<T, Global>>>::Error>

§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>

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

fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T, Global>) -> Arc<dyn Any + Send + Sync, Global>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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<E, T, U> TryIntoVal<E, T> for Uwhere E: Env, T: TryFromVal<E, U>,

§

type Error = <T as TryFromVal<E, U>>::Error

source§

fn try_into_val(&self, env: &E) -> Result<T, <U as TryIntoVal<E, T>>::Error>

§

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

§

fn vzip(self) -> V