Struct exar::Subscription [] [src]

pub struct Subscription {
    pub event_stream_sender: Sender<EventStreamMessage>,
    pub query: Query,
    // some fields omitted
}

Exar DB's subscription.

Examples

extern crate exar;

use exar::*;
use std::sync::mpsc::channel;

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

let mut subscription = Subscription::new(sender, Query::current());
subscription.send(event).unwrap();
let event_stream_message = receiver.recv().unwrap();

Fields

event_stream_sender: Sender<EventStreamMessage>

The channel sender used to stream EventStreamMessages back to the subscriber.

query: Query

The query associated to this subscription.

Methods

impl Subscription
[src]

fn new(sender: Sender<EventStreamMessage>, query: Query) -> Subscription

Creates a new Subscription with the given channel sender and query.

fn send(&mut self, event: Event) -> Result<()DatabaseError>

Sends an Event to the subscriber or returns a DatabaseError if a failure occurs.

fn is_active(&self) -> bool

Returns wether the subscription is still active.

fn matches_event(&self, event: &Event) -> bool

Returns wether the subscription is interested in the given Event.

Trait Implementations

impl Debug for Subscription
[src]

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

Formats the value using the given formatter.

impl Clone for Subscription
[src]

fn clone(&self) -> Subscription

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