pub trait Encode {
// Required method
fn encode(&self) -> Vec<u8> ⓘ;
// Provided methods
fn required_len(&self) -> u64 { ... }
fn is_dynamic() -> bool { ... }
}
Expand description
Declares a type to be encodable as a Solidity type
Required Methods§
Provided Methods§
Sourcefn required_len(&self) -> u64
fn required_len(&self) -> u64
The number of bytes required to encode the current type.
This can be a static or dynamic value based on the type. The value should be 32 bytes aligned, and does not include the 32 bytes required for the offset.
Sourcefn is_dynamic() -> bool
fn is_dynamic() -> bool
Is this type considered dynamic
by solidity
If the type is dynamic then the value
of this field is actually the offset
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.