[][src]Struct rust_rocket::client::RocketClient

pub struct RocketClient { /* fields omitted */ }

The RocketClient type. This contains the connected socket and other fields.

Implementations

impl RocketClient[src]

pub fn new() -> Result<Self, Error>[src]

Construct a new RocketClient.

This constructs a new Rocket client and connects to localhost on port 1338.

Errors

Error::Connect if connection cannot be established, or Error::Handshake if the handshake fails.

Examples

let mut rocket = RocketClient::new().unwrap();

pub fn connect(addr: impl ToSocketAddrs) -> Result<Self, Error>[src]

Construct a new RocketClient.

This constructs a new Rocket client and connects to a specified host and port.

Errors

Error::Connect if connection cannot be established, or Error::Handshake if the handshake fails.

Examples

let mut rocket = RocketClient::connect(("localhost", 1338)).unwrap();

pub fn get_track_mut(&mut self, name: &str) -> Result<&mut Track, Error>[src]

Get track by name.

If the track does not yet exist it will be created.

Errors

This method can return an Error::IOError if Rocket tracker disconnects.

Panics

Will panic if name's length exceeds u32::MAX.

Examples

let track = rocket.get_track_mut("namespace:track").unwrap();
track.get_value(3.5);

pub fn get_track(&self, name: &str) -> Option<&Track>[src]

Get track by name.

You should use get_track_mut to create a track.

pub fn save_tracks(&self) -> Vec<Track>[src]

Create a clone of the tracks in the session which can then be serialized to a file in any format with a serde implementation. Tracks can be turned into a RocketPlayer for playback.

pub fn set_row(&mut self, row: u32) -> Result<(), Error>[src]

Send a SetRow message.

This changes the current row on the tracker side.

Errors

This method can return an Error::IOError if Rocket tracker disconnects.

pub fn poll_events(&mut self) -> Result<Option<Event>, Error>[src]

Poll for new events from the tracker.

This polls from events from the tracker. You should call this fairly often your main loop. It is recommended to keep calling this as long as your receive Some(Event).

Errors

This method can return an Error::IOError if Rocket tracker disconnects.

Examples

while let Some(event) = rocket.poll_events().unwrap() {
    match event {
        // Do something with the various events.
        _ => (),
    }
}

Trait Implementations

impl Debug for RocketClient[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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.