[][src]Struct f1_api::packet::header::Header

pub struct Header { /* fields omitted */ }

Header prefixing each packet

The modern F1 games use versioned API specifications. Each packet is prefixed with a header that declares which version of the specification the packet adheres to. This information is required to decode the packet correctly. Because it is only relevant for decoding the packet, the packet format, type, and version from the specifications are not republished.

The header also contains information about the session the packet belongs to, and about the time the packet was created.

TODO Verify that the session tie can be represented as a duration

Methods

impl Header[src]

pub fn new(
    api_spec: ApiSpec,
    game_version: Option<GameVersion>,
    packet_type: PacketType,
    session_uid: u64,
    session_time: Duration,
    frame_identifier: u32,
    player_car_index: VehicleIndex
) -> Self
[src]

Constructs a new Header.

impl Header[src]

pub fn game_version(&self) -> &Option<GameVersion>[src]

Returns the version of the game.

pub fn session_time(&self) -> &Duration[src]

Returns the session time at the time the packet was sent.

impl Header[src]

pub fn api_spec(&self) -> ApiSpec[src]

Returns the API specification that was used to decode the packet.

pub fn packet_type(&self) -> PacketType[src]

Returns the type of the packet.

The packet type is only required to determine how to decode the packet. After decoding it, the packet type is represented by Rust's type system.

pub fn session_uid(&self) -> u64[src]

Returns the unique session UID.

pub fn frame_identifier(&self) -> u32[src]

Returns the frame identifier at the time the packet was sent.

pub fn player_car_index(&self) -> VehicleIndex[src]

Returns the player's car index.

The setups and status of cars are published as arrays. This field indicates which position in these arrays the player's car has.

Trait Implementations

impl Clone for Header[src]

impl Copy for Header[src]

impl Debug for Header[src]

impl Display for Header[src]

impl Eq for Header[src]

impl Hash for Header[src]

impl Ord for Header[src]

impl PartialEq<Header> for Header[src]

impl PartialOrd<Header> for Header[src]

impl StructuralEq for Header[src]

impl StructuralPartialEq for Header[src]

Auto Trait Implementations

impl RefUnwindSafe for Header

impl Send for Header

impl Sync for Header

impl Unpin for Header

impl UnwindSafe for Header

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.