[][src]Struct iracing::Connection

pub struct Connection { /* fields omitted */ }

iRacing live telemetry and session data connection.

Allows retrival of live data fro iRacing. The data is provided using a shared memory map, allowing the simulator to deposit data roughly every 16ms to be read.

Examples

use iracing::Connection;
 
let _ = Connection::new().expect("Unable to find telemetry data");

Implementations

impl Connection[src]

pub fn new() -> IOResult<Connection>[src]

pub unsafe fn read_header(from: *const c_void) -> Header[src]

Get the data header

Reads the data header from the shared memory map and returns a copy of the header which can be used safely elsewhere.

Examples

use iracing::Connection;
 
let location_of_an_iracing_header: *const c_void;
let header = Connection::read_header(location_of_an_iracing_header);
 
println!("Data Version: {}", header.version);

pub fn session_info(&mut self) -> Result<SessionDetails, Box<dyn Error>>[src]

Get session information

Get general session information - This data is mostly static and contains overall information related to the current or replayed session

Examples

use iracing::Connection;
 
match Connection::new().expect("Unable to open session").session_info() {
    Ok(session) => println!("Track Name: {}", session.weekend.track_display_name),
    Err(e) => println!("Invalid Session")
};

pub fn telemetry(&self) -> Result<Sample, Box<dyn Error>>[src]

Get latest telemetry.

Get the latest live telemetry data, the telemetry is updated roughtly every 16ms

Examples

use iracing::Connection;
 
let sample = Connection::new()?.telemetry()?;

pub fn blocking(&self) -> IOResult<Blocking>[src]

Get Blocking Telemetry Interface.

Creates a new iracing::telemetry::Blocking connector which allows telemetry samples to be collected, and will wait and block until a new sample is available, or a timeout is reached.

Examples

use iracing::Connection;
use std::time::Duration;
 
let sampler = Connection::new()?.blocking()?;
let sample = sample.sample(Duration::from_millis(50))?;

pub fn close(&self) -> IOResult<()>[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.