Struct TypeId

Source
pub struct TypeId(/* private fields */);

Implementations§

Source§

impl TypeId

Source

pub fn unit(db: &dyn AnalyzerDb) -> Self

Source

pub fn bool(db: &dyn AnalyzerDb) -> Self

Source

pub fn int(db: &dyn AnalyzerDb, int: Integer) -> Self

Source

pub fn address(db: &dyn AnalyzerDb) -> Self

Source

pub fn base(db: &dyn AnalyzerDb, t: Base) -> Self

Source

pub fn tuple(db: &dyn AnalyzerDb, items: &[TypeId]) -> Self

Source

pub fn typ(&self, db: &dyn AnalyzerDb) -> Type

Source

pub fn deref_typ(&self, db: &dyn AnalyzerDb) -> Type

Source

pub fn deref(self, db: &dyn AnalyzerDb) -> TypeId

Source

pub fn make_sptr(self, db: &dyn AnalyzerDb) -> TypeId

Source

pub fn has_fixed_size(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_primitive(&self, db: &dyn AnalyzerDb) -> bool

true if Type::Base or Type::Contract (which is just an Address)

Source

pub fn is_bool(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_contract(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_integer(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_map(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_string(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_self_ty(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn as_struct(&self, db: &dyn AnalyzerDb) -> Option<StructId>

Source

pub fn as_trait_or_type(&self) -> TraitOrType

Source

pub fn is_struct(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_sptr(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_generic(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn is_mut(&self, db: &dyn AnalyzerDb) -> bool

Source

pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr

Source

pub fn kind_display_name(&self, db: &dyn AnalyzerDb) -> &str

Source

pub fn get_impl_for( &self, db: &dyn AnalyzerDb, trait_: TraitId, ) -> Option<ImplId>

Return the impl for the given trait. There can only ever be a single implementation per concrete type and trait.

Source

pub fn trait_function_candidates( &self, context: &mut dyn AnalyzerContext, fn_name: &str, ) -> (Vec<(FunctionId, ImplId)>, Vec<(FunctionId, ImplId)>)

Looks up all possible candidates of the given function name that are implemented via traits. Groups results in two lists, the first contains all theoretical possible candidates and the second contains only those that are actually callable because the trait is in scope.

Source

pub fn function_sig( &self, db: &dyn AnalyzerDb, name: &str, ) -> Option<FunctionSigId>

Signature for the function with the given name defined directly on the type. Does not consider trait impls.

Source

pub fn function_sigs( &self, db: &dyn AnalyzerDb, name: &str, ) -> Rc<[FunctionSigId]>

Like function_sig but returns a Vec<FunctionSigId> which not only considers functions natively implemented on the type but also those that are provided by implemented traits on the type.

Source

pub fn self_function( &self, db: &dyn AnalyzerDb, name: &str, ) -> Option<FunctionSigId>

Source

pub fn is_emittable(self, db: &dyn AnalyzerDb) -> bool

Returns true if the type qualifies to implement the Emittable trait TODO: This function should be removed when we add Encode / Decode trait

Source

pub fn is_encodable(self, db: &dyn AnalyzerDb) -> Result<bool, TypeError>

Returns true if the type is encodable in Solidity ABI. TODO: This function must be removed when we add Encode/Decode trait.

Trait Implementations§

Source§

impl Clone for TypeId

Source§

fn clone(&self) -> TypeId

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 TypeId

Source§

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

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

impl Default for TypeId

Source§

fn default() -> TypeId

Returns the “default value” for a type. Read more
Source§

impl DisplayWithDb for TypeId

Source§

fn format(&self, db: &dyn AnalyzerDb, f: &mut Formatter<'_>) -> Result

Source§

impl Hash for TypeId

Source§

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

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 InternKey for TypeId

Source§

fn from_intern_id(v: InternId) -> Self

Create an instance of the intern-key from a u32 value.
Source§

fn as_intern_id(&self) -> InternId

Extract the u32 with which the intern-key was created.
Source§

impl Ord for TypeId

Source§

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

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

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

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

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

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

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

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

impl PartialEq for TypeId

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for TypeId

Source§

fn partial_cmp(&self, other: &TypeId) -> 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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl TypeDowncast for TypeId

Source§

fn as_array(&self, db: &dyn AnalyzerDb) -> Option<Array>

Source§

fn as_tuple(&self, db: &dyn AnalyzerDb) -> Option<Tuple>

Source§

fn as_string(&self, db: &dyn AnalyzerDb) -> Option<FeString>

Source§

fn as_map(&self, db: &dyn AnalyzerDb) -> Option<Map>

Source§

fn as_int(&self, db: &dyn AnalyzerDb) -> Option<Integer>

Source§

impl Copy for TypeId

Source§

impl Eq for TypeId

Source§

impl StructuralPartialEq for TypeId

Auto Trait Implementations§

§

impl Freeze for TypeId

§

impl RefUnwindSafe for TypeId

§

impl Send for TypeId

§

impl Sync for TypeId

§

impl Unpin for TypeId

§

impl UnwindSafe for TypeId

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<T> Displayable for T
where T: DisplayWithDb,

Source§

fn display<'a, 'b>( &'a self, db: &'b dyn AnalyzerDb, ) -> DisplayableWrapper<'b, &'a Self>

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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> ToOwned for T
where T: Clone,

Source§

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

Source§

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

Source§

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<N> NodeTrait for N
where N: Copy + Ord + Hash,