pub struct TypeDef { /* private fields */ }
Available on crate feature
eip712
only.Expand description
An EIP-712 type definition.
Implementations§
Source§impl TypeDef
impl TypeDef
Sourcepub fn new<S: Into<String>>(
type_name: S,
props: Vec<PropertyDef>,
) -> Result<Self>
pub fn new<S: Into<String>>( type_name: S, props: Vec<PropertyDef>, ) -> Result<Self>
Instantiate a new type definition, checking that the type name is a valid root type.
Sourcepub const fn new_unchecked(type_name: String, props: Vec<PropertyDef>) -> Self
pub const fn new_unchecked(type_name: String, props: Vec<PropertyDef>) -> Self
Instantiate a new type definition, without checking that the type name is a valid root type. This may result in bad behavior in a resolver.
Sourcepub fn props(&self) -> &[PropertyDef]
pub fn props(&self) -> &[PropertyDef]
Returns the property definitions of the type definition.
Sourcepub fn prop_names(&self) -> impl Iterator<Item = &str> + '_
pub fn prop_names(&self) -> impl Iterator<Item = &str> + '_
Returns the property names of the type definition.
Sourcepub fn prop_root_types(&self) -> impl Iterator<Item = &str> + '_
pub fn prop_root_types(&self) -> impl Iterator<Item = &str> + '_
Returns the root property types of the type definition.
Sourcepub fn prop_types(&self) -> impl Iterator<Item = &str> + '_
pub fn prop_types(&self) -> impl Iterator<Item = &str> + '_
Returns the property types of the type definition.
Sourcepub fn eip712_encode_type(&self) -> String
pub fn eip712_encode_type(&self) -> String
Produces the EIP-712 encodeType
typestring for this type definition.
Sourcepub fn fmt_eip712_encode_type(&self, f: &mut impl Write) -> Result
pub fn fmt_eip712_encode_type(&self, f: &mut impl Write) -> Result
Formats the EIP-712 encodeType
typestring for this type definition
into f
.
Sourcepub fn props_bytes_len(&self) -> usize
pub fn props_bytes_len(&self) -> usize
Returns the number of bytes that the properties of this type definition
will take up when formatted in the EIP-712 encodeType
typestring.
Trait Implementations§
Source§impl Ord for TypeDef
impl Ord for TypeDef
Source§impl PartialOrd for TypeDef
impl PartialOrd for TypeDef
impl Eq for TypeDef
impl StructuralPartialEq for TypeDef
Auto Trait Implementations§
impl Freeze for TypeDef
impl RefUnwindSafe for TypeDef
impl Send for TypeDef
impl Sync for TypeDef
impl Unpin for TypeDef
impl UnwindSafe for TypeDef
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)