Enum syn_solidity::Type
source · pub enum Type {
Address(Span, Option<payable>),
Bool(Span),
String(Span),
Bytes(Span),
FixedBytes(Span, NonZeroU16),
Int(Span, Option<NonZeroU16>),
Uint(Span, Option<NonZeroU16>),
Array(TypeArray),
Tuple(TypeTuple),
Function(TypeFunction),
Mapping(TypeMapping),
Custom(SolPath),
}
Expand description
A type name.
Solidity reference: https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.typeName
Variants§
Address(Span, Option<payable>)
address $(payable)?
Bool(Span)
bool
String(Span)
string
Bytes(Span)
bytes
FixedBytes(Span, NonZeroU16)
bytes<size>
Int(Span, Option<NonZeroU16>)
int[size]
Uint(Span, Option<NonZeroU16>)
uint[size]
Array(TypeArray)
$ty[$($size)?]
Tuple(TypeTuple)
$(tuple)? ( $($types,)* )
Function(TypeFunction)
function($($arguments),*) $($attributes)* $(returns ($($returns),+))?
Mapping(TypeMapping)
mapping ($key $($key_name)? => $value $($value_name)?)
Custom(SolPath)
A custom type.
Implementations§
source§impl Type
impl Type
pub fn peek(lookahead: &Lookahead1<'_>) -> bool
pub fn custom(ident: Ident) -> Self
pub fn span(&self) -> Span
pub fn set_span(&mut self, new_span: Span)
sourcepub const fn is_one_word(&self) -> bool
pub const fn is_one_word(&self) -> bool
Returns whether this type is ABI-encoded as a single EVM word (32 bytes).
sourcepub fn is_abi_dynamic(&self) -> bool
pub fn is_abi_dynamic(&self) -> bool
Returns whether this type is dynamic according to ABI rules.
pub const fn is_array(&self) -> bool
pub const fn is_tuple(&self) -> bool
pub const fn is_custom(&self) -> bool
pub fn has_custom(&self) -> bool
Trait Implementations§
source§impl FromIterator<Type> for TypeTuple
impl FromIterator<Type> for TypeTuple
source§impl PartialEq<Type> for Type
impl PartialEq<Type> for Type
impl Eq 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<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
Mutably borrows from an owned value. Read more