Struct exar::Event [] [src]

pub struct Event {
    pub id: u64,
    pub data: String,
    pub tags: Vec<String>,
    pub timestamp: u64,
}

Exar DB's event.

Examples

extern crate exar;

use exar::*;

let event = Event::new("data", vec!["tag1", "tag2"]);

Fields

id: u64

The event id (or sequence number).

data: String

The event data/payload.

tags: Vec<String>

The event tags.

timestamp: u64

The event timestamp.

Methods

impl Event
[src]

fn new(data: &str, tags: Vec<&str>) -> Event

Returns a new Event with the given data and tags.

fn with_id(self, id: u64) -> Self

Returns a modified version of the event by setting its id to the given value.

fn with_timestamp(self, timestamp: u64) -> Self

Returns a modified version of the event by setting its timestamp to the given value.

fn with_current_timestamp(self) -> Self

Returns a modified version of the event by setting its timestamp to the current time.

Trait Implementations

impl Decodable for Event
[src]

fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<Event, __D::Error>

impl Encodable for Event
[src]

fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S::Error>

impl Eq for Event
[src]

impl PartialEq for Event
[src]

fn eq(&self, __arg_0: &Event) -> bool

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

fn ne(&self, __arg_0: &Event) -> bool

This method tests for !=.

impl Debug for Event
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Clone for Event
[src]

fn clone(&self) -> Event

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Display for Event
[src]

fn fmt(&self, f: &mut Formatter) -> DisplayResult

Formats the value using the given formatter.

impl ToTabSeparatedString for Event
[src]

fn to_tab_separated_string(&self) -> String

Returns a tab-separated string from the value.

impl FromTabSeparatedStr for Event
[src]

fn from_tab_separated_str(s: &str) -> Result<EventParseError>

Returns an instance of Self from a tab-separated string slice or a ParseError if a failure occurs while parsing the string. Read more

impl Validation for Event
[src]

fn validate(&self) -> Result<()ValidationError>

Validates the type or returns a ValidationError if validation fails.

fn validated(self) -> Result<Self, ValidationError>

Validates and returns Self or a ValidationError if validation fails.