[−][src]Struct f1_api::packet::header::Header
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]
api_spec: ApiSpec,
game_version: Option<GameVersion>,
packet_type: PacketType,
session_uid: u64,
session_time: Duration,
frame_identifier: u32,
player_car_index: VehicleIndex
) -> Self
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Header
[src]
fn cmp(&self, other: &Header) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Header> for Header
[src]
impl PartialOrd<Header> for Header
[src]
fn partial_cmp(&self, other: &Header) -> Option<Ordering>
[src]
fn lt(&self, other: &Header) -> bool
[src]
fn le(&self, other: &Header) -> bool
[src]
fn gt(&self, other: &Header) -> bool
[src]
fn ge(&self, other: &Header) -> bool
[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,