Skip to content

Commit 86fe0f8

Browse files
Merge branch 'master' into fix/safety
2 parents 91171a6 + 1210484 commit 86fe0f8

File tree

5 files changed

+156
-114
lines changed

5 files changed

+156
-114
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
name: Build & Test
22

33
on:
4+
workflow_dispatch:
45
push:
5-
branches: [ master ]
6+
branches: [master]
67
pull_request:
7-
branches: [ master ]
8+
branches: [master]
89

910
jobs:
1011
build:
11-
1212
runs-on: windows-latest
1313

1414
steps:
15-
- uses: actions/checkout@v2
16-
- name: Lint
17-
run: cargo clippy --tests --examples --all-features
18-
- name: Formatting
19-
run: cargo fmt -- --check
20-
- name: Docs build
21-
run: cargo doc --no-deps --all-features
22-
- name: Build
23-
run: cargo build --release --examples --verbose --all-features
24-
- name: Check Tests Compile (don't run because we'd need iRacing running for that)
25-
run: cargo test --verbose --lib --no-run --all-features
15+
- uses: actions/checkout@v2
16+
- name: Lint
17+
run: cargo clippy --tests --examples --all-features
18+
- name: Formatting
19+
run: cargo fmt -- --check
20+
- name: Docs build
21+
run: cargo doc --no-deps --all-features
22+
- name: Build
23+
run: cargo build --release --examples --verbose --all-features
24+
- name: Check Tests Compile (don't run because we'd need iRacing running for that)
25+
run: cargo test --verbose --lib --no-run --all-features

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ telemetry = ["winapi"]
1414
bitflags = "1.2"
1515
chrono = "0.4"
1616
encoding_rs = "0.8"
17+
libc = { version = "0.2", optional = true }
1718
serde = {version = "1.0", features = ["derive"] }
1819
serde_yaml = "0.8"
19-
winapi = {version = "0.3.9", features = ["std","memoryapi","winnt","errhandlingapi","synchapi","handleapi"], optional = true }
20+
thiserror = "1.0"
21+
winapi = {version = "0.3", features = ["std","memoryapi","winnt","errhandlingapi","synchapi","handleapi"], optional = true }
2022

2123
[package.metadata.docs.rs]
2224
default-target = "x86_64-pc-windows-msvc"

examples/dump_sample.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use serde_yaml::to_string;
33

44
pub fn main() {
55
let conn = Connection::new().expect("Unable to open telemetry");
6-
let telem = conn.telemetry().expect("Telem");
6+
let telem = conn.telemetry();
77

88
print!("{}", to_string(&telem.all()).unwrap());
99
}

src/states.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use bitflags::bitflags;
2+
use serde::{Deserialize, Serialize};
23

3-
#[derive(Debug, Copy, Clone)]
4+
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
45
pub enum SessionState {
56
Invalid(i32),
67
GetInCar,
@@ -29,7 +30,7 @@ bitflags! {
2930
///
3031
/// Current warnings / status flags of the player's engine.
3132
///
32-
#[derive(Default)]
33+
#[derive(Default, Serialize, Deserialize)]
3334
pub struct EngineWarnings: u32 {
3435
/// Water Temperature too high
3536
const WATER_TEMPERATURE = 0x01;
@@ -62,7 +63,7 @@ bitflags! {
6263
///
6364
/// let very_scenic = CameraState::UI_HIDDEN | CameraState::IS_SCENIC_ACTIVE;
6465
/// ```
65-
#[derive(Default)]
66+
#[derive(Default, Serialize, Deserialize)]
6667
pub struct CameraState: u32 {
6768
const IS_SESSION_SCREEN = 0x01;
6869
const IS_SCENIC_ACTIVE = 0x02;
@@ -80,7 +81,7 @@ bitflags! {
8081
bitflags! {
8182
///
8283
/// Bitfield of requested services for the next pitstop.
83-
#[derive(Default)]
84+
#[derive(Default, Serialize, Deserialize)]
8485
pub struct PitServices: u32 {
8586
const CHANGE_LEFT_FRONT = 0x01;
8687
const CHANGE_RIGHT_FRONT = 0x02;
@@ -93,7 +94,7 @@ bitflags! {
9394
}
9495

9596
bitflags! {
96-
#[derive(Default)]
97+
#[derive(Default, Serialize, Deserialize)]
9798
pub struct Flags: u32 {
9899
const CHECKERED_FLAG = 0x01;
99100
const WHITE_FLAG = 1 << 1;
@@ -128,7 +129,7 @@ bitflags! {
128129
/**
129130
* Action which will be initiated by the "RESET" button
130131
*/
131-
#[derive(Debug, Copy, Clone)]
132+
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
132133
pub enum ResetAction {
133134
Enter,
134135
Exit,
@@ -144,7 +145,7 @@ impl Default for ResetAction {
144145
/**
145146
* Current units being displayed
146147
*/
147-
#[derive(Debug, Copy, Clone)]
148+
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
148149
pub enum Units {
149150
Imperial,
150151
Metric,

0 commit comments

Comments
 (0)