Enum bytecode::mut_ref_instrumentation::Type
pub enum Type {
Primitive(PrimitiveType),
Tuple(Vec<Type, Global>),
Vector(Box<Type, Global>),
Struct(ModuleId, StructId, Vec<Type, Global>),
TypeParameter(u16),
Reference(bool, Box<Type, Global>),
Fun(Vec<Type, Global>, Box<Type, Global>),
TypeDomain(Box<Type, Global>),
ResourceDomain(ModuleId, StructId, Option<Vec<Type, Global>>),
Error,
Var(u16),
}
Expand description
Represents a type.
Variants§
Primitive(PrimitiveType)
Tuple(Vec<Type, Global>)
Vector(Box<Type, Global>)
Struct(ModuleId, StructId, Vec<Type, Global>)
TypeParameter(u16)
Reference(bool, Box<Type, Global>)
Fun(Vec<Type, Global>, Box<Type, Global>)
TypeDomain(Box<Type, Global>)
ResourceDomain(ModuleId, StructId, Option<Vec<Type, Global>>)
Error
Var(u16)
Implementations§
§impl Type
impl Type
pub fn new_prim(p: PrimitiveType) -> Type
pub fn is_type_parameter(&self) -> bool
pub fn is_type_parameter(&self) -> bool
Determines whether this is a type parameter.
pub fn is_reference(&self) -> bool
pub fn is_reference(&self) -> bool
Determines whether this is a reference.
pub fn is_mutable_reference(&self) -> bool
pub fn is_mutable_reference(&self) -> bool
Determines whether this is a mutable reference.
pub fn is_immutable_reference(&self) -> bool
pub fn is_immutable_reference(&self) -> bool
Determines whether this is an immutable reference.
pub fn is_struct_or_vector_of_struct(&self) -> bool
pub fn is_struct_or_vector_of_struct(&self) -> bool
Determines whether this is a struct, or a vector of structs, or a reference to any of those.
pub fn is_spec(&self) -> bool
pub fn is_spec(&self) -> bool
Returns true if this type is a specification language only type or contains specification language only types
pub fn is_signer_or_address(&self) -> bool
pub fn is_signer_or_address(&self) -> bool
Returns true if this is an address or signer type.
pub fn is_address(&self) -> bool
pub fn is_address(&self) -> bool
Return true if this is an account address
pub fn skip_reference(&self) -> &Type
pub fn skip_reference(&self) -> &Type
Skip reference type.
pub fn replace_struct_instantiation(&self, inst: &[Type]) -> Type
pub fn replace_struct_instantiation(&self, inst: &[Type]) -> Type
If this is a struct type, replace the type instantiation.
pub fn get_struct<'env>(
&'env self,
env: &'env GlobalEnv
) -> Option<(StructEnv<'env>, &'env [Type])>
pub fn get_struct<'env>( &'env self, env: &'env GlobalEnv ) -> Option<(StructEnv<'env>, &'env [Type])>
If this is a struct type, return the associated struct env and type parameters.
pub fn require_struct(&self) -> (ModuleId, StructId, &[Type])
pub fn require_struct(&self) -> (ModuleId, StructId, &[Type])
Require this to be a struct, if so extracts its content.
pub fn instantiate(&self, params: &[Type]) -> Type
pub fn instantiate(&self, params: &[Type]) -> Type
Instantiates type parameters in this type.
pub fn instantiate_vec(
vec: Vec<Type, Global>,
params: &[Type]
) -> Vec<Type, Global> ⓘ
pub fn instantiate_vec( vec: Vec<Type, Global>, params: &[Type] ) -> Vec<Type, Global> ⓘ
Instantiate type parameters in the vector of types.
pub fn instantiate_slice(slice: &[Type], params: &[Type]) -> Vec<Type, Global> ⓘ
pub fn instantiate_slice(slice: &[Type], params: &[Type]) -> Vec<Type, Global> ⓘ
Instantiate type parameters in the slice of types.
pub fn type_param_map_to_inst(
arity: usize,
map: BTreeMap<u16, Type, Global>
) -> Vec<Type, Global> ⓘ
pub fn type_param_map_to_inst( arity: usize, map: BTreeMap<u16, Type, Global> ) -> Vec<Type, Global> ⓘ
Convert a partial assignment for type parameters into an instantiation.
pub fn contains<P>(&self, p: &P) -> boolwhere
P: Fn(&Type) -> bool,
pub fn contains<P>(&self, p: &P) -> boolwhere P: Fn(&Type) -> bool,
Checks whether this type contains a type for which the predicate is true.
pub fn is_incomplete(&self) -> bool
pub fn is_incomplete(&self) -> bool
Returns true if this type is incomplete, i.e. contains any type variables.
pub fn is_open(&self) -> bool
pub fn is_open(&self) -> bool
Return true if this type contains generic types (i.e., types that can be instantiated).
pub fn module_usage(&self, usage: &mut BTreeSet<ModuleId, Global>)
pub fn module_usage(&self, usage: &mut BTreeSet<ModuleId, Global>)
Compute used modules in this type, adding them to the passed set.
pub fn into_struct_type(self, env: &GlobalEnv) -> Option<Type>
pub fn into_struct_type(self, env: &GlobalEnv) -> Option<Type>
Attempt to convert this type into a normalized::Type
pub fn into_normalized_type(self, env: &GlobalEnv) -> Option<Type>
pub fn into_normalized_type(self, env: &GlobalEnv) -> Option<Type>
Attempt to convert this type into a normalized::Type
pub fn into_struct_tag(self, env: &GlobalEnv) -> Option<StructTag>
pub fn into_struct_tag(self, env: &GlobalEnv) -> Option<StructTag>
Attempt to convert this type into a language_storage::StructTag
pub fn into_type_tag(self, env: &GlobalEnv) -> Option<TypeTag>
pub fn into_type_tag(self, env: &GlobalEnv) -> Option<TypeTag>
Attempt to convert this type into a language_storage::TypeTag
pub fn from_type_tag(t: &TypeTag, env: &GlobalEnv) -> Type
pub fn from_type_tag(t: &TypeTag, env: &GlobalEnv) -> Type
Create a Type
from t
pub fn visit<F>(&self, visitor: &mut F)where F: FnMut(&Type),
Trait Implementations§
§impl Ord for Type
impl Ord for Type
§impl PartialOrd<Type> for Type
impl PartialOrd<Type> for Type
§fn partial_cmp(&self, other: &Type) -> Option<Ordering>
fn partial_cmp(&self, other: &Type) -> 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 moreimpl Eq for Type
impl StructuralEq for Type
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnwindSafe for Type
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.