pub struct SessionInfoParser { /* private fields */ }Expand description
Session info parser with YAML preprocessing for iRacing compatibility
Implementations§
Source§impl SessionInfoParser
impl SessionInfoParser
Sourcepub fn parse_from_memory(
&mut self,
memory: &[u8],
session_info_offset: i32,
session_info_len: i32,
session_version: u32,
) -> Result<SessionInfo>
pub fn parse_from_memory( &mut self, memory: &[u8], session_info_offset: i32, session_info_len: i32, session_version: u32, ) -> Result<SessionInfo>
Parse session info from shared memory with caching
Sourcepub fn extract_yaml_from_memory(
&self,
memory: &[u8],
offset: i32,
length: i32,
) -> Result<String>
pub fn extract_yaml_from_memory( &self, memory: &[u8], offset: i32, length: i32, ) -> Result<String>
Extract YAML string from shared memory
Sourcepub fn preprocess_iracing_yaml(&self, yaml: &str) -> Result<String>
pub fn preprocess_iracing_yaml(&self, yaml: &str) -> Result<String>
Preprocess iRacing YAML to fix compatibility issues with unescaped characters Based on iRacing forum discussion: https://forums.iracing.com/discussion/comment/374646#Comment_374646
Sourcepub fn parse(&self, yaml: &str) -> Result<SessionInfo>
pub fn parse(&self, yaml: &str) -> Result<SessionInfo>
Parse YAML to SessionInfo struct (with automatic preprocessing)
Sourcepub fn validate_session_info(&self, session_info: &SessionInfo) -> Result<()>
pub fn validate_session_info(&self, session_info: &SessionInfo) -> Result<()>
Validate parsed session info for completeness
Sourcepub fn get_cached(&self, version: u32) -> Option<SessionInfo>
pub fn get_cached(&self, version: u32) -> Option<SessionInfo>
Get cached session info if valid for version
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear session info cache
Trait Implementations§
Source§impl Clone for SessionInfoParser
impl Clone for SessionInfoParser
Source§fn clone(&self) -> SessionInfoParser
fn clone(&self) -> SessionInfoParser
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionInfoParser
impl Debug for SessionInfoParser
Auto Trait Implementations§
impl Freeze for SessionInfoParser
impl RefUnwindSafe for SessionInfoParser
impl Send for SessionInfoParser
impl Sync for SessionInfoParser
impl Unpin for SessionInfoParser
impl UnwindSafe for SessionInfoParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more