Struct evm_coder::abi::AbiReader

source ·
pub struct AbiReader<'i> { /* private fields */ }
Expand description

View into RLP data, which provides method to read typed items from it

Implementations§

source§

impl<'i> AbiReader<'i>

source

pub fn new(buf: &'i [u8]) -> Self

Start reading RLP buffer, assuming there is no padding bytes

source

pub fn new_call(buf: &'i [u8]) -> Result<(Bytes4, Self)>

Start reading RLP buffer, parsing first 4 bytes as selector

Errors

Fails if provided buffer has not enough length for selector+data

source

pub fn address(&mut self) -> Result<H160>

Read H160 at current position, then advance

source

pub fn bool(&mut self) -> Result<bool>

Read bool at current position, then advance

source

pub fn bytes4(&mut self) -> Result<[u8; 4]>

Read [[u8; 4]] at current position, then advance

source

pub fn bytes(&mut self) -> Result<Vec<u8>>

Read Vec<u8> at current position, then advance

source

pub fn string(&mut self) -> Result<String>

Read String at current position, then advance

source

pub fn uint8(&mut self) -> Result<u8>

Read u8 at current position, then advance

source

pub fn uint32(&mut self) -> Result<u32>

Read u32 at current position, then advance

source

pub fn uint128(&mut self) -> Result<u128>

Read u128 at current position, then advance

source

pub fn uint256(&mut self) -> Result<U256>

Read U256 at current position, then advance

source

pub fn uint64(&mut self) -> Result<u64>

Read u64 at current position, then advance

source

pub fn read_usize(&mut self) -> Result<usize>

👎Deprecated: dangerous, as usize may have different width in wasm and native execution

Read usize at current position, then advance

source

pub fn subresult(&mut self, size: Option<usize>) -> Result<AbiReader<'i>>

Slice recursive buffer, advance one word for buffer offset If size is None then offsets evals from internal buffer.

Errors

Fails on bad subresult offset

source

pub fn bytes_read(&mut self, size: usize)

Notify about readed data portion.

source

pub fn is_finished(&self) -> bool

Is this parser reached end of buffer?

Trait Implementations§

source§

impl<'i> Clone for AbiReader<'i>

source§

fn clone(&self) -> AbiReader<'i>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<'i> RefUnwindSafe for AbiReader<'i>

§

impl<'i> Send for AbiReader<'i>

§

impl<'i> Sync for AbiReader<'i>

§

impl<'i> Unpin for AbiReader<'i>

§

impl<'i> UnwindSafe for AbiReader<'i>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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 Twhere U: TryFrom<T>,

§

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.
§

impl<T> JsonSchemaMaybe for T