[][src]Struct mixer_wrappers::constellation::ConstellationClient

pub struct ConstellationClient {
    pub join_handle: JoinHandle<()>,
    // some fields omitted
}

Wrapper for connecting and interacting with Constellation.

Fields

join_handle: JoinHandle<()>

Internal thread join handle

Methods

impl ConstellationClient[src]

pub fn connect(client_id: &str) -> Result<(Self, Receiver<String>), Error>[src]

Connect to Constellation.

Arguments

  • client_id - your client ID

Examples

use mixer_wrappers::ConstellationClient;
let (client, receiver) = ConstellationClient::connect("aaa").unwrap();

pub fn call_method(
    &mut self,
    method: &str,
    params: &HashMap<String, Value>
) -> Result<(), Error>
[src]

Call a method, sending data to the socket.

Arguments

  • method - method name
  • params - method parameters

Examples

let mut map = HashMap::new();
map.insert(String::from("abc"), json!(123));
if let Err(e) = client.call_method("some_method", &map) {
    // ...
}

pub fn subscribe(&mut self, events: &[&str]) -> Result<(), Error>[src]

Subscribe to events.

The documentation on this method is found here, as well as a listing of events.

Arguments

  • events - slice of event names to subscribe to

Examples

client.subscribe(&["aaa", "bbb"]).unwrap();

pub fn unsubscribe(&mut self, events: &[&str]) -> Result<(), Error>[src]

Unsubscribe from events.

The documentation on this method is found here, as well as a listing of events.

Arguments

  • events - slice of event names to subscribe to

Examples

client.unsubscribe(&["aaa", "bbb"]).unwrap();

pub fn parse(message: &str) -> Result<StreamMessage, Error>[src]

Helper method to parse the JSON messages into structs.

Arguments

  • message - String message from the receiver

Examples

let message = ConstellationClient::parse("{\"type\":\"event\"...}").unwrap();

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Erased for T

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err