Struct dazeus::Event [] [src]

pub struct Event {
    pub event: EventType,
    pub params: Vec<String>,
}

An event received from the DaZeus server.

You can retrieve the parameters from the event using one of three different methods:

  1. Using the params field directly.
  2. Using the param() method with an index which will return a string slice.
  3. Using indexing on the event struct itself, i.e. event[0] to receive the first parameter.

The prefered method is the last one.

Fields

The type of event that was received.

The parameters attached to the event.

Methods

impl Event
[src]

Create a new event based on the basic properties of an event.

Allows creation of events for testing purposes. Also used internally for constructing events based on parsed Json objects.

Example

Event::new(EventType::PrivMsg, vec!(
   "network".to_string(),
   "sender".to_string(),
   "receiver".to_string(),
   "message".to_string()
))

Create a new event based on a Json data object.

Typically this method will be called by the bindings itself to create an event instance from some received json blob from the core.

Retrieve a parameter from the list of parameters contained in the event.

Retrieve the number of parameters for the event.

Trait Implementations

impl Debug for Event
[src]

Formats the value using the given formatter.

impl Clone for Event
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Event
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'b> Index<usize> for Event
[src]

The returned type after indexing

The method for the indexing (container[index]) operation