mirror of
https://github.com/maciejpedzich/f1-game-packet-parser.git
synced 2025-04-12 00:21:11 +02:00
style: set rustfmt print width to 90
This commit is contained in:
parent
dd881a66c0
commit
5d59668900
@ -1,4 +1,4 @@
|
|||||||
max_width = 80
|
max_width = 90
|
||||||
format_code_in_doc_comments = true
|
format_code_in_doc_comments = true
|
||||||
imports_granularity = "Crate"
|
imports_granularity = "Crate"
|
||||||
imports_layout = "Vertical"
|
imports_layout = "Vertical"
|
||||||
|
@ -11,16 +11,7 @@ pub(crate) const MAX_NUM_CARS: usize = 22;
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum PacketId {
|
pub enum PacketId {
|
||||||
@ -43,16 +34,7 @@ pub enum PacketId {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(i8))]
|
#[br(little, repr(i8))]
|
||||||
pub enum MarshalZoneFlag {
|
pub enum MarshalZoneFlag {
|
||||||
@ -66,16 +48,7 @@ pub enum MarshalZoneFlag {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum Weather {
|
pub enum Weather {
|
||||||
@ -89,16 +62,7 @@ pub enum Weather {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum SessionType {
|
pub enum SessionType {
|
||||||
@ -120,16 +84,7 @@ pub enum SessionType {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(i8))]
|
#[br(little, repr(i8))]
|
||||||
pub enum TemperatureChange {
|
pub enum TemperatureChange {
|
||||||
@ -140,16 +95,7 @@ pub enum TemperatureChange {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(i8))]
|
#[br(little, repr(i8))]
|
||||||
pub enum TrackId {
|
pub enum TrackId {
|
||||||
@ -191,16 +137,7 @@ pub enum TrackId {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum Formula {
|
pub enum Formula {
|
||||||
@ -218,16 +155,7 @@ pub enum Formula {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum SafetyCarStatus {
|
pub enum SafetyCarStatus {
|
||||||
@ -239,16 +167,7 @@ pub enum SafetyCarStatus {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum ForecastAccuracy {
|
pub enum ForecastAccuracy {
|
||||||
@ -258,16 +177,7 @@ pub enum ForecastAccuracy {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum BrakingAssist {
|
pub enum BrakingAssist {
|
||||||
@ -279,16 +189,7 @@ pub enum BrakingAssist {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum GearboxAssist {
|
pub enum GearboxAssist {
|
||||||
@ -300,16 +201,7 @@ pub enum GearboxAssist {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum DynamicRacingLine {
|
pub enum DynamicRacingLine {
|
||||||
@ -320,16 +212,7 @@ pub enum DynamicRacingLine {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum DynamicRacingLineType {
|
pub enum DynamicRacingLineType {
|
||||||
@ -339,16 +222,7 @@ pub enum DynamicRacingLineType {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum GameMode {
|
pub enum GameMode {
|
||||||
@ -374,16 +248,7 @@ pub enum GameMode {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum RuleSet {
|
pub enum RuleSet {
|
||||||
@ -400,16 +265,7 @@ pub enum RuleSet {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum SessionLength {
|
pub enum SessionLength {
|
||||||
@ -424,16 +280,7 @@ pub enum SessionLength {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum PitStatus {
|
pub enum PitStatus {
|
||||||
@ -444,16 +291,7 @@ pub enum PitStatus {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum DriverStatus {
|
pub enum DriverStatus {
|
||||||
@ -466,16 +304,7 @@ pub enum DriverStatus {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum ResultStatus {
|
pub enum ResultStatus {
|
||||||
@ -491,16 +320,7 @@ pub enum ResultStatus {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum PenaltyType {
|
pub enum PenaltyType {
|
||||||
@ -526,16 +346,7 @@ pub enum PenaltyType {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum InfringementType {
|
pub enum InfringementType {
|
||||||
@ -595,16 +406,7 @@ pub enum InfringementType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Debug,
|
Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Hash, Serialize, Deserialize,
|
||||||
Clone,
|
|
||||||
Copy,
|
|
||||||
PartialEq,
|
|
||||||
Eq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Hash,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
pub struct ButtonStatus(u32);
|
pub struct ButtonStatus(u32);
|
||||||
|
|
||||||
@ -689,16 +491,7 @@ bitflags! {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum Nationality {
|
pub enum Nationality {
|
||||||
@ -794,16 +587,7 @@ pub enum Nationality {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum YourTelemetry {
|
pub enum YourTelemetry {
|
||||||
@ -813,16 +597,7 @@ pub enum YourTelemetry {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum Surface {
|
pub enum Surface {
|
||||||
@ -841,16 +616,7 @@ pub enum Surface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Debug,
|
Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Hash, Serialize, Deserialize,
|
||||||
Clone,
|
|
||||||
Copy,
|
|
||||||
PartialEq,
|
|
||||||
Eq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Hash,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
pub struct RevLights(u16);
|
pub struct RevLights(u16);
|
||||||
|
|
||||||
@ -891,16 +657,7 @@ bitflags! {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum MfdPanelIndex {
|
pub enum MfdPanelIndex {
|
||||||
@ -914,16 +671,7 @@ pub enum MfdPanelIndex {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum TractionControl {
|
pub enum TractionControl {
|
||||||
@ -934,16 +682,7 @@ pub enum TractionControl {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum FuelMix {
|
pub enum FuelMix {
|
||||||
@ -955,16 +694,7 @@ pub enum FuelMix {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum ErsDeployMode {
|
pub enum ErsDeployMode {
|
||||||
@ -976,16 +706,7 @@ pub enum ErsDeployMode {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(i8))]
|
#[br(little, repr(i8))]
|
||||||
pub enum VehicleFiaFlag {
|
pub enum VehicleFiaFlag {
|
||||||
@ -999,16 +720,7 @@ pub enum VehicleFiaFlag {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(i8))]
|
#[br(little, repr(i8))]
|
||||||
pub enum DrsAllowed {
|
pub enum DrsAllowed {
|
||||||
@ -1019,16 +731,7 @@ pub enum DrsAllowed {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum ActualTyreCompound {
|
pub enum ActualTyreCompound {
|
||||||
@ -1052,16 +755,7 @@ pub enum ActualTyreCompound {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum VisualTyreCompound {
|
pub enum VisualTyreCompound {
|
||||||
@ -1082,16 +776,7 @@ pub enum VisualTyreCompound {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum ReadyStatus {
|
pub enum ReadyStatus {
|
||||||
@ -1101,16 +786,7 @@ pub enum ReadyStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Debug,
|
Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Hash, Serialize, Deserialize,
|
||||||
Clone,
|
|
||||||
Copy,
|
|
||||||
PartialEq,
|
|
||||||
Eq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Hash,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
pub struct LapValid(u8);
|
pub struct LapValid(u8);
|
||||||
|
|
||||||
@ -1129,16 +805,7 @@ bitflags! {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum SpeedUnit {
|
pub enum SpeedUnit {
|
||||||
@ -1148,16 +815,7 @@ pub enum SpeedUnit {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum TemperatureUnit {
|
pub enum TemperatureUnit {
|
||||||
@ -1167,16 +825,7 @@ pub enum TemperatureUnit {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(little, repr(u8))]
|
#[br(little, repr(u8))]
|
||||||
pub enum Platform {
|
pub enum Platform {
|
||||||
@ -1187,3 +836,14 @@ pub enum Platform {
|
|||||||
Origin = 6,
|
Origin = 6,
|
||||||
Unknown = 255,
|
Unknown = 255,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[non_exhaustive]
|
||||||
|
#[derive(
|
||||||
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
|
)]
|
||||||
|
#[br(little, repr(u8))]
|
||||||
|
pub enum RecoveryMode {
|
||||||
|
None = 0,
|
||||||
|
Flashbacks = 1,
|
||||||
|
AutoRecovery = 2,
|
||||||
|
}
|
||||||
|
15
src/lib.rs
15
src/lib.rs
@ -4,10 +4,9 @@ pub mod packets;
|
|||||||
use crate::constants::PacketId;
|
use crate::constants::PacketId;
|
||||||
use crate::packets::{
|
use crate::packets::{
|
||||||
u8_to_usize, F1PacketCarDamage, F1PacketCarSetups, F1PacketCarStatus,
|
u8_to_usize, F1PacketCarDamage, F1PacketCarSetups, F1PacketCarStatus,
|
||||||
F1PacketCarTelemetry, F1PacketEvent, F1PacketFinalClassification,
|
F1PacketCarTelemetry, F1PacketEvent, F1PacketFinalClassification, F1PacketLap,
|
||||||
F1PacketLap, F1PacketLobbyInfo, F1PacketMotion, F1PacketMotionEx,
|
F1PacketLobbyInfo, F1PacketMotion, F1PacketMotionEx, F1PacketParticipants,
|
||||||
F1PacketParticipants, F1PacketSession, F1PacketSessionHistory,
|
F1PacketSession, F1PacketSessionHistory, F1PacketTyreSets,
|
||||||
F1PacketTyreSets,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use binrw::io::Cursor;
|
use binrw::io::Cursor;
|
||||||
@ -33,9 +32,7 @@ pub struct F1Packet {
|
|||||||
|
|
||||||
/// F1 game packet's header.
|
/// F1 game packet's header.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(
|
#[br(
|
||||||
little,
|
little,
|
||||||
assert(
|
assert(
|
||||||
@ -81,9 +78,7 @@ pub struct F1PacketHeader {
|
|||||||
|
|
||||||
/// F1 game packet's body.
|
/// F1 game packet's body.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(packet_format: u16, packet_id: PacketId))]
|
#[br(little, import(packet_format: u16, packet_id: PacketId))]
|
||||||
pub struct F1PacketBody {
|
pub struct F1PacketBody {
|
||||||
/// Physics data for all cars in the session.
|
/// Physics data for all cars in the session.
|
||||||
|
@ -3,9 +3,7 @@ use binrw::BinRead;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(_packet_format: u16))]
|
#[br(little, import(_packet_format: u16))]
|
||||||
pub struct CarDamageData {
|
pub struct CarDamageData {
|
||||||
/// Tyre wear percentage for all wheels.
|
/// Tyre wear percentage for all wheels.
|
||||||
|
@ -2,9 +2,7 @@ use binrw::BinRead;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(_packet_format: u16))]
|
#[br(little, import(_packet_format: u16))]
|
||||||
pub struct CarSetupData {
|
pub struct CarSetupData {
|
||||||
/// Front wing aero
|
/// Front wing aero
|
||||||
|
@ -8,9 +8,7 @@ use binrw::BinRead;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(
|
#[br(
|
||||||
little,
|
little,
|
||||||
import(packet_format: u16),
|
import(packet_format: u16),
|
||||||
|
@ -5,9 +5,7 @@ use binrw::BinRead;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(
|
#[br(
|
||||||
little,
|
little,
|
||||||
import(_packet_format: u16),
|
import(_packet_format: u16),
|
||||||
|
@ -5,9 +5,7 @@ use binrw::BinRead;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little)]
|
#[br(little)]
|
||||||
pub enum EventDataDetails {
|
pub enum EventDataDetails {
|
||||||
/// Sent when the session starts.
|
/// Sent when the session starts.
|
||||||
|
@ -5,9 +5,7 @@ use binrw::BinRead;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(
|
#[br(
|
||||||
little,
|
little,
|
||||||
import(_packet_format: u16),
|
import(_packet_format: u16),
|
||||||
|
@ -6,9 +6,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
/// Lap data for a car on track.
|
/// Lap data for a car on track.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(
|
#[br(
|
||||||
little,
|
little,
|
||||||
import(packet_format: u16),
|
import(packet_format: u16),
|
||||||
|
@ -5,9 +5,7 @@ use binrw::BinRead;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(packet_format: u16))]
|
#[br(little, import(packet_format: u16))]
|
||||||
pub struct LobbyInfoData {
|
pub struct LobbyInfoData {
|
||||||
/// Whether the vehicle is controlled by AI.
|
/// Whether the vehicle is controlled by AI.
|
||||||
|
@ -13,10 +13,9 @@ pub mod session_history;
|
|||||||
pub mod tyre_sets;
|
pub mod tyre_sets;
|
||||||
|
|
||||||
use crate::constants::{
|
use crate::constants::{
|
||||||
BrakingAssist, DynamicRacingLine, DynamicRacingLineType, ForecastAccuracy,
|
BrakingAssist, DynamicRacingLine, DynamicRacingLineType, ForecastAccuracy, Formula,
|
||||||
Formula, GameMode, GearboxAssist, MfdPanelIndex, RuleSet, SafetyCarStatus,
|
GameMode, GearboxAssist, MfdPanelIndex, RuleSet, SafetyCarStatus, SessionLength,
|
||||||
SessionLength, SessionType, SpeedUnit, TemperatureUnit, TrackId, Weather,
|
SessionType, SpeedUnit, TemperatureUnit, TrackId, Weather, MAX_NUM_CARS,
|
||||||
MAX_NUM_CARS,
|
|
||||||
};
|
};
|
||||||
use crate::packets::car_damage::CarDamageData;
|
use crate::packets::car_damage::CarDamageData;
|
||||||
use crate::packets::car_setups::CarSetupData;
|
use crate::packets::car_setups::CarSetupData;
|
||||||
@ -32,15 +31,13 @@ use crate::packets::session::{MarshalZone, WeatherForecastSample};
|
|||||||
use crate::packets::session_history::{LapHistoryData, TyreStintHistoryData};
|
use crate::packets::session_history::{LapHistoryData, TyreStintHistoryData};
|
||||||
use crate::packets::tyre_sets::TyreSetData;
|
use crate::packets::tyre_sets::TyreSetData;
|
||||||
|
|
||||||
use binrw::{BinRead, BinResult};
|
use binrw::BinRead;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::string::FromUtf8Error;
|
use std::string::FromUtf8Error;
|
||||||
|
|
||||||
/// Physics data for all the cars being driven.
|
/// Physics data for all the cars being driven.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(packet_format: u16))]
|
#[br(little, import(packet_format: u16))]
|
||||||
pub struct F1PacketMotion {
|
pub struct F1PacketMotion {
|
||||||
/// Motion data for all cars on track.
|
/// Motion data for all cars on track.
|
||||||
@ -55,9 +52,7 @@ pub struct F1PacketMotion {
|
|||||||
/// Data about the ongoing session.
|
/// Data about the ongoing session.
|
||||||
#[allow(clippy::struct_excessive_bools)]
|
#[allow(clippy::struct_excessive_bools)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(
|
#[br(
|
||||||
little,
|
little,
|
||||||
import(packet_format: u16),
|
import(packet_format: u16),
|
||||||
@ -217,9 +212,7 @@ pub struct F1PacketSession {
|
|||||||
|
|
||||||
/// Data about all the lap times of cars in the session.
|
/// Data about all the lap times of cars in the session.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(packet_format: u16))]
|
#[br(little, import(packet_format: u16))]
|
||||||
pub struct F1PacketLap {
|
pub struct F1PacketLap {
|
||||||
/// Lap data for all cars on track.
|
/// Lap data for all cars on track.
|
||||||
@ -235,9 +228,7 @@ pub struct F1PacketLap {
|
|||||||
|
|
||||||
/// Various notable events that happen during a session.
|
/// Various notable events that happen during a session.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(_packet_format: u16))]
|
#[br(little, import(_packet_format: u16))]
|
||||||
pub struct F1PacketEvent {
|
pub struct F1PacketEvent {
|
||||||
/// 4-letter event code.
|
/// 4-letter event code.
|
||||||
@ -252,9 +243,7 @@ pub struct F1PacketEvent {
|
|||||||
|
|
||||||
/// Data of participants in the session, mostly relevant for multiplayer.
|
/// Data of participants in the session, mostly relevant for multiplayer.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(
|
#[br(
|
||||||
little,
|
little,
|
||||||
import(packet_format: u16),
|
import(packet_format: u16),
|
||||||
@ -279,9 +268,7 @@ pub struct F1PacketParticipants {
|
|||||||
/// In multiplayer games, other player cars will appear as blank.
|
/// In multiplayer games, other player cars will appear as blank.
|
||||||
/// You will only be able to see your car setup and AI cars.
|
/// You will only be able to see your car setup and AI cars.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(packet_format: u16))]
|
#[br(little, import(packet_format: u16))]
|
||||||
pub struct F1PacketCarSetups {
|
pub struct F1PacketCarSetups {
|
||||||
/// Setup data for all cars on track.
|
/// Setup data for all cars on track.
|
||||||
@ -292,9 +279,7 @@ pub struct F1PacketCarSetups {
|
|||||||
|
|
||||||
/// Telemetry (such as speed, DRS, throttle application, etc.)
|
/// Telemetry (such as speed, DRS, throttle application, etc.)
|
||||||
/// for all cars in the race.
|
/// for all cars in the race.
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(
|
#[br(
|
||||||
little,
|
little,
|
||||||
import(packet_format: u16),
|
import(packet_format: u16),
|
||||||
@ -319,9 +304,7 @@ pub struct F1PacketCarTelemetry {
|
|||||||
|
|
||||||
/// Car status data for each car in the race.
|
/// Car status data for each car in the race.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(packet_format: u16))]
|
#[br(little, import(packet_format: u16))]
|
||||||
pub struct F1PacketCarStatus {
|
pub struct F1PacketCarStatus {
|
||||||
/// Status data for all cars. Should have a size of 22.
|
/// Status data for all cars. Should have a size of 22.
|
||||||
@ -331,9 +314,7 @@ pub struct F1PacketCarStatus {
|
|||||||
|
|
||||||
/// Final classification confirmation at the end of a race.
|
/// Final classification confirmation at the end of a race.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(
|
#[br(
|
||||||
little,
|
little,
|
||||||
import(packet_format: u16),
|
import(packet_format: u16),
|
||||||
@ -356,9 +337,7 @@ pub struct F1PacketFinalClassification {
|
|||||||
|
|
||||||
/// Packet detailing all the players that are currently in a multiplayer lobby.
|
/// Packet detailing all the players that are currently in a multiplayer lobby.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(
|
#[br(
|
||||||
little,
|
little,
|
||||||
import(packet_format: u16),
|
import(packet_format: u16),
|
||||||
@ -381,9 +360,7 @@ pub struct F1PacketLobbyInfo {
|
|||||||
|
|
||||||
/// Car damage parameters for all cars in the session.
|
/// Car damage parameters for all cars in the session.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(packet_format: u16))]
|
#[br(little, import(packet_format: u16))]
|
||||||
pub struct F1PacketCarDamage {
|
pub struct F1PacketCarDamage {
|
||||||
/// Car damage data. Should have a size of 22.
|
/// Car damage data. Should have a size of 22.
|
||||||
@ -393,9 +370,7 @@ pub struct F1PacketCarDamage {
|
|||||||
|
|
||||||
/// Packet detailing lap and tyre data history for a given driver in the session
|
/// Packet detailing lap and tyre data history for a given driver in the session
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(
|
#[br(
|
||||||
little,
|
little,
|
||||||
import(packet_format: u16),
|
import(packet_format: u16),
|
||||||
@ -448,9 +423,7 @@ pub struct F1PacketSessionHistory {
|
|||||||
/// In-depth details about tyre sets assigned to a vehicle during the session.
|
/// In-depth details about tyre sets assigned to a vehicle during the session.
|
||||||
/// Available from the 2023 format onwards.
|
/// Available from the 2023 format onwards.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(packet_format: u16))]
|
#[br(little, import(packet_format: u16))]
|
||||||
pub struct F1PacketTyreSets {
|
pub struct F1PacketTyreSets {
|
||||||
/// Index of the car this packet relates to.
|
/// Index of the car this packet relates to.
|
||||||
@ -468,9 +441,7 @@ pub struct F1PacketTyreSets {
|
|||||||
/// - part of [`F1PacketMotion`] in the 2022 format
|
/// - part of [`F1PacketMotion`] in the 2022 format
|
||||||
/// - standalone packet from the 2023 format onwards
|
/// - standalone packet from the 2023 format onwards
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(packet_format: u16))]
|
#[br(little, import(packet_format: u16))]
|
||||||
pub struct F1PacketMotionEx {
|
pub struct F1PacketMotionEx {
|
||||||
/// Positions of suspension for each wheel.
|
/// Positions of suspension for each wheel.
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
use binrw::BinRead;
|
use binrw::BinRead;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(_packet_format: u16))]
|
#[br(little, import(_packet_format: u16))]
|
||||||
pub struct CarMotionData {
|
pub struct CarMotionData {
|
||||||
/// World space X position in metres.
|
/// World space X position in metres.
|
||||||
|
@ -5,9 +5,7 @@ use binrw::BinRead;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(packet_format: u16))]
|
#[br(little, import(packet_format: u16))]
|
||||||
pub struct ParticipantsData {
|
pub struct ParticipantsData {
|
||||||
/// Whether the vehicle is controlled by AI
|
/// Whether the vehicle is controlled by AI
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
use crate::constants::{
|
use crate::constants::{MarshalZoneFlag, SessionType, TemperatureChange, Weather};
|
||||||
MarshalZoneFlag, SessionType, TemperatureChange, Weather,
|
|
||||||
};
|
|
||||||
use binrw::BinRead;
|
use binrw::BinRead;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Section of the track supervised by marshals.
|
/// Section of the track supervised by marshals.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(
|
#[br(
|
||||||
little,
|
little,
|
||||||
import(_packet_format: u16),
|
import(_packet_format: u16),
|
||||||
@ -27,9 +23,7 @@ pub struct MarshalZone {
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
/// Weather forecast sample for a given session.
|
/// Weather forecast sample for a given session.
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(
|
#[br(
|
||||||
little,
|
little,
|
||||||
import(_packet_format: u16),
|
import(_packet_format: u16),
|
||||||
|
@ -5,9 +5,7 @@ use binrw::BinRead;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(packet_format: u16))]
|
#[br(little, import(packet_format: u16))]
|
||||||
pub struct LapHistoryData {
|
pub struct LapHistoryData {
|
||||||
/// Lap time in milliseconds.
|
/// Lap time in milliseconds.
|
||||||
@ -36,9 +34,7 @@ pub struct LapHistoryData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize)]
|
||||||
BinRead, PartialEq, PartialOrd, Clone, Debug, Serialize, Deserialize,
|
|
||||||
)]
|
|
||||||
#[br(little, import(_packet_format: u16))]
|
#[br(little, import(_packet_format: u16))]
|
||||||
pub struct TyreStintHistoryData {
|
pub struct TyreStintHistoryData {
|
||||||
/// Lap the tyre usage ends on (255 if current tyre).
|
/// Lap the tyre usage ends on (255 if current tyre).
|
||||||
|
@ -6,16 +6,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(
|
#[derive(
|
||||||
BinRead,
|
BinRead, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize,
|
||||||
Eq,
|
|
||||||
PartialEq,
|
|
||||||
Ord,
|
|
||||||
PartialOrd,
|
|
||||||
Copy,
|
|
||||||
Clone,
|
|
||||||
Debug,
|
|
||||||
Serialize,
|
|
||||||
Deserialize,
|
|
||||||
)]
|
)]
|
||||||
#[br(
|
#[br(
|
||||||
little,
|
little,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user