pub struct Event {
pub name: String,
pub inputs: Vec<EventParam>,
pub anonymous: bool,
}
Expand description
A JSON ABI event.
Fields§
§name: String
The name of the event.
inputs: Vec<EventParam>
A list of the event’s inputs, in order.
anonymous: bool
Whether 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<Self>
pub fn parse(s: &str) -> Result<Self>
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 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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)