pub enum ElementaryType {
Address(bool),
Bool,
String,
Bytes,
Fixed(TypeSize, TypeFixedSize),
UFixed(TypeSize, TypeFixedSize),
Int(TypeSize),
UInt(TypeSize),
FixedBytes(TypeSize),
}Expand description
Elementary/primitive type.
Reference: https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.elementaryTypeName
Variants§
Address(bool)
Ethereum address, 20-byte fixed-size byte array.
address $(payable)?
Bool
Boolean.
bool
String
UTF-8 string.
string
Bytes
Dynamic byte array.
bytes
Fixed(TypeSize, TypeFixedSize)
Signed fixed-point number.
fixedMxN where M @ 0..=32, N @ 0..=80. M is the number of bytes, not bits.
UFixed(TypeSize, TypeFixedSize)
Unsigned fixed-point number.
ufixedMxN where M @ 0..=32, N @ 0..=80. M is the number of bytes, not bits.
Int(TypeSize)
Signed integer. The number is the number of bytes, not bits.
0 => int
size @ 1..=32 => int{size*8}
33.. => unreachable!()
UInt(TypeSize)
Unsigned integer. The number is the number of bytes, not bits.
0 => uint
size @ 1..=32 => uint{size*8}
33.. => unreachable!()
FixedBytes(TypeSize)
Fixed-size byte array.
size @ 1..=32 => bytes{size}
0 | 33.. => unreachable!()
Implementations§
Source§impl ElementaryType
impl ElementaryType
Sourcepub fn to_abi_str(self) -> Cow<'static, str>
pub fn to_abi_str(self) -> Cow<'static, str>
Returns the Solidity ABI representation of the type as a string.
Sourcepub fn write_abi_str<W>(self, f: &mut W) -> Result<(), Error>
pub fn write_abi_str<W>(self, f: &mut W) -> Result<(), Error>
Writes the Solidity ABI representation of the type to a formatter.
Sourcepub const fn is_value_type(self) -> bool
pub const fn is_value_type(self) -> bool
Returns true if the type is a value type.
Reference: https://docs.soliditylang.org/en/latest/types.html#value-types
Sourcepub const fn is_reference_type(self) -> bool
pub const fn is_reference_type(self) -> bool
Returns true if the type is a reference type.
Trait Implementations§
Source§impl Clone for ElementaryType
impl Clone for ElementaryType
Source§fn clone(&self) -> ElementaryType
fn clone(&self) -> ElementaryType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ElementaryType
impl Debug for ElementaryType
Source§impl Display for ElementaryType
impl Display for ElementaryType
Source§impl Hash for ElementaryType
impl Hash for ElementaryType
Source§impl PartialEq for ElementaryType
impl PartialEq for ElementaryType
impl Copy for ElementaryType
impl Eq for ElementaryType
impl StructuralPartialEq for ElementaryType
Auto Trait Implementations§
impl Freeze for ElementaryType
impl RefUnwindSafe for ElementaryType
impl Send for ElementaryType
impl Sync for ElementaryType
impl Unpin for ElementaryType
impl UnwindSafe for ElementaryType
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<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> 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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
fn equivalent(&self, key: &K) -> bool
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more