Skip to main content

Layout

Struct Layout 

Source
pub struct Layout { /* private fields */ }
Expand description

A parsed storage layout.

Implementations§

Source§

impl Layout

Source

pub fn from_json(s: &str) -> Result<Self>

Accepts either a bare storageLayout object or a whole forge/hardhat artifact that contains one.

Source

pub fn from_artifact(path: impl AsRef<Path>) -> Result<Self>

Layout::from_json on the contents of path.

Source

pub fn fields(&self) -> impl Iterator<Item = &StorageEntry>

Top-level variables in declaration order.

Source

pub fn locate(&self, path: &str) -> Result<Location>

Resolve a dotted/indexed path to its storage location.

Source

pub fn decode(&self, loc: &Location, word: B256) -> Value

Decode the value at loc out of a full 32-byte storage word.

Source

pub fn kind_of(&self, path: &str) -> Result<PathKind>

What kind of thing a path names — a leaf value, or a container that takes another path segment. Drives the Node view proxy.

Source

pub fn decode_typed(&self, loc: &Location, word: B256) -> (ValueKind, Value)

Decode with an explicit kind, so callers that marshal across a language boundary know what the text is.

Source

pub fn typescript(&self, name: &str) -> String

TypeScript declaration of the contract’s storage as the Node view exposes it: bigint for integers, boolean, string for addresses and bytes, nested objects for structs, index signatures for mappings and arrays. name is the interface name.

Source

pub fn describe_slot( &self, slot: B256, array_probe: u64, ) -> Vec<(String, Location)>

Human name(s) for a raw slot: top-level values, struct members, and dynamic-array elements within array_probe slots of the data start. Mapping entries cannot be named without a candidate key.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.