Struct alloy_sol_type_parser::RootType
source · pub struct RootType<'a>(/* private fields */);Expand description
A root type, with no array suffixes. Corresponds to a single, non-sequence type. This is the most basic type specifier.
Examples
let root_type = RootType::parse("uint256")?;
assert_eq!(root_type.span(), "uint256");
// Allows unknown types
assert_eq!(RootType::parse("MyStruct")?.span(), "MyStruct");
// No sequences
assert!(RootType::parse("uint256[2]").is_err());
// No tuples
assert!(RootType::parse("(uint256,uint256)").is_err());Implementations§
source§impl<'a> RootType<'a>
impl<'a> RootType<'a>
sourcepub const unsafe fn new_unchecked(s: &'a str) -> Self
pub const unsafe fn new_unchecked(s: &'a str) -> Self
Create a new root type from a string without checking if it’s valid.
Safety
The string passed in must be a valid Solidity identifier. See
is_valid_identifier.
sourcepub fn try_basic_solidity(self) -> Result<()>
pub fn try_basic_solidity(self) -> Result<()>
Returns Ok(()) if the type is a basic Solidity type.
Trait Implementations§
source§impl<'a> Ord for RootType<'a>
impl<'a> Ord for RootType<'a>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<'a> PartialEq for RootType<'a>
impl<'a> PartialEq for RootType<'a>
source§impl<'a> PartialOrd for RootType<'a>
impl<'a> PartialOrd for RootType<'a>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moreimpl<'a> Copy for RootType<'a>
impl<'a> Eq for RootType<'a>
impl<'a> StructuralEq for RootType<'a>
impl<'a> StructuralPartialEq for RootType<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for RootType<'a>
impl<'a> Send for RootType<'a>
impl<'a> Sync for RootType<'a>
impl<'a> Unpin for RootType<'a>
impl<'a> UnwindSafe for RootType<'a>
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