pub struct Event {
pub name: String,
pub inputs: Vec<EventParam>,
pub anonymous: bool,
}json-abi only.Expand description
A JSON ABI event.
Fields§
§name: StringThe name of the event.
inputs: Vec<EventParam>A list of the event’s inputs, in order.
anonymous: boolWhether the event is anonymous. Anonymous events do not have their signature included in the topic 0. Instead, the indexed arguments are 0-indexed.
Implementations§
Source§impl Event
impl Event
Sourcepub fn parse(s: &str) -> Result<Event, Error>
pub fn parse(s: &str) -> Result<Event, Error>
Parses a Solidity event signature string: $(event)? $name($($inputs),*) $(anonymous)?
If you want to parse a generic Human-Readable ABI string, use AbiItem::parse.
§Examples
assert_eq!(
Event::parse("event foo(bool bar, uint indexed baz)"),
Ok(Event {
name: "foo".to_string(),
inputs: vec![
EventParam::parse("bool bar").unwrap(),
EventParam::parse("uint indexed baz").unwrap()
],
anonymous: false,
}),
);Sourcepub fn signature(&self) -> String
pub fn signature(&self) -> String
Returns this event’s signature: $name($($inputs),*).
This is the preimage input used to compute the selector.
Sourcepub fn full_signature(&self) -> String
pub fn full_signature(&self) -> String
Returns this event’s full signature
event $name($($inputs indexed $names),*).
This is a full human-readable string, including all parameter names, any optional modifiers (e.g. indexed) and white-space to aid in human readability. This is useful for storing a string which can still fully reconstruct the original Fragment
Sourcepub fn selector(&self) -> FixedBytes<32>
pub fn selector(&self) -> FixedBytes<32>
Computes this event’s selector: keccak256(self.signature())
Sourcepub fn num_topics(&self) -> usize
pub fn num_topics(&self) -> usize
Computes the number of this event’s indexed topics.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Event, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Event, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl EventExt for Event
impl EventExt for Event
Source§fn decode_log_parts<I>(
&self,
topics: I,
data: &[u8],
validate: bool,
) -> Result<DecodedEvent, Error>where
I: IntoIterator<Item = FixedBytes<32>>,
fn decode_log_parts<I>(
&self,
topics: I,
data: &[u8],
validate: bool,
) -> Result<DecodedEvent, Error>where
I: IntoIterator<Item = FixedBytes<32>>,
Source§fn decode_log(
&self,
log: &LogData,
validate: bool,
) -> Result<DecodedEvent, Error>
fn decode_log( &self, log: &LogData, validate: bool, ) -> Result<DecodedEvent, Error>
Source§impl Serialize for Event
impl Serialize for Event
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl Specifier<DynSolEvent> for Event
impl Specifier<DynSolEvent> for Event
impl Eq for Event
impl StructuralPartialEq for Event
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> ⓘ
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> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 56 bytes