pub struct Decoder { /* private fields */ }
Expand description
Decode logs parsing topics and log data.
Implementations§
Source§impl Decoder
impl Decoder
Sourcepub fn from_signatures<S: AsRef<str>>(signatures: &[S]) -> Result<Self>
pub fn from_signatures<S: AsRef<str>>(signatures: &[S]) -> Result<Self>
Initialize decoder from event signatures.
use hypersync_client::Decoder;
let decoder = Decoder::from_signatures(&[
"Transfer(address indexed from, address indexed to, uint amount)",
]).unwrap();
Sourcepub fn decode_log(&self, log: &Log) -> Result<Option<DecodedEvent>>
pub fn decode_log(&self, log: &Log) -> Result<Option<DecodedEvent>>
Parse log and return decoded event.
Returns Ok(None) if topic0 not found.
Sourcepub fn decode(
&self,
topic0: &[u8],
topics: &[Option<LogArgument>],
data: &[u8],
) -> Result<Option<DecodedEvent>>
pub fn decode( &self, topic0: &[u8], topics: &[Option<LogArgument>], data: &[u8], ) -> Result<Option<DecodedEvent>>
Decode log.data into event using parsed topic0 and topics.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Decoder
impl RefUnwindSafe for Decoder
impl Send for Decoder
impl Sync for Decoder
impl Unpin for Decoder
impl UnwindSafe for Decoder
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more