Struct rust_rocket::client::Rocket
[−]
[src]
pub struct Rocket { /* fields omitted */ }
The Rocket
type. This contains the connected socket and other fields.
Methods
impl Rocket
[src]
fn new() -> Result<Rocket, RocketErr>
Construct a new Rocket.
This constructs a new rocket and connect to localhost on port 1338.
Errors
If a connection cannot be established, or if the handshake fails.
This will raise a RocketErr
.
Examples
use rocket::Rocket; let mut rocket = Rocket::new();
fn connect(host: &str, port: u16) -> Result<Rocket, RocketErr>
Construct a new Rocket.
This constructs a new rocket and connects to a specified host and port.
Errors
If a connection cannot be established, or if the handshake fails.
This will raise a RocketErr
.
Examples
use rocket::Rocket; let mut rocket = Rocket::connect("localhost", 1338);
fn get_track_mut(&mut self, name: &str) -> &Track
Get a track by name.
If the track does not yet exist it will be created.
Examples
let track = rocket.get_track_mut("namespace:track"); track.get_value(3.5);
fn get_track(&self, name: &str) -> &Track
Get Track by name.
If it does not exist, it will panic.
You should use get_track_mut
instead.
fn set_row(&mut self, row: u32)
Send a SetRow message.
This changes the current row on the tracker side.
fn poll_events(&mut self) -> Option<Event>
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).
Examples
while let Some(Event) = rocket.poll_events() { match event { // Do something with the various events. _ => (), } }