pub struct Client { /* private fields */ }Expand description
Client is main entry point into the library. Create a client and then you can access Sessions that have the telemetry data in then.
Implementations§
Source§impl Client
impl Client
Sourcepub unsafe fn session(&mut self) -> Option<Session>
pub unsafe fn session(&mut self) -> Option<Session>
When iRacing is running, then a Session will be available that contains the telemetry data. When iRacing is not running, then this returns None. See also wait_for_session.
§Safety
Creating a session requires dealing with memory mapped files and c strucutres that are in them. A mismatch between our definition of the struct and iRacings definition could cause chaos.
Sourcepub unsafe fn wait_for_session(&mut self, wait: Duration) -> Option<Session>
pub unsafe fn wait_for_session(&mut self, wait: Duration) -> Option<Session>
Will wait upto the the supplied wait duration for a iRacing session to be available. If the wait timeout’s returns None, otherwise returns the new Session. Wait must fit into a 32bit number of milliseconds, about 49 days. otherwise it’ll panic.
§Safety
Creating a session requires dealing with memory mapped files and c strucutres that are in them. A mismatch between our definition of the struct and iRacings definition could cause chaos.