[][src]Struct f1_api::packet::lap::Lap

pub struct Lap { /* fields omitted */ }

Data about a car and its lap times

For each car in the session, a set of lap data is published. It contains data on the current lap, e.g. the current lap time and the sector the car is currently in, but also the time of the last and best lap.

Methods

impl Lap[src]

pub fn new(
    last_lap_time: Duration,
    current_lap_time: Duration,
    best_lap_time: Duration,
    sector1_time: Duration,
    sector2_time: Duration,
    lap_distance: f32,
    total_distance: f32,
    safety_car_delta: Duration,
    position: u8,
    current_lap_number: u8,
    pit_status: PitStatus,
    sector: Sector,
    is_valid_lap: bool,
    penalties: u8,
    grid_position: u8,
    driver_status: DriverStatus,
    result_status: ResultStatus
) -> Self
[src]

Constructs a new Lap.

impl Lap[src]

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

Returns the time of the last lap.

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

Returns the time of the current lap.

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

Returns the time of the best lap.

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

Returns the time spent in sector 1 during the current lap.

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

Returns the time spent in sector 2 during the current lap.

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

Returns the delta during a safety car in seconds.

impl Lap[src]

pub fn lap_distance(&self) -> f32[src]

Returns the distance the car has travelled in the current lap in meters.

pub fn total_distance(&self) -> f32[src]

Returns the total distance the car has travelled in the session in meters.

pub fn position(&self) -> u8[src]

Returns a car's position in the race.

pub fn current_lap_number(&self) -> u8[src]

Returns the number of the current lap.

pub fn pit_status(&self) -> PitStatus[src]

Returns a car's pit stop status.

pub fn sector(&self) -> Sector[src]

Returns the sector the car is currently in.

pub fn is_valid_lap(&self) -> bool[src]

Returns whether the current lap is valid.

The F1 games apply different rules to determine if a lap is valid. Cutting the track, losing control, or hitting objects or opponents can all invalidate a lap. This is crucial for qualifying, where invalid laps might not count for the results.

pub fn penalties(&self) -> u8[src]

Returns the accumulated penalties for a car in seconds.

pub fn grid_position(&self) -> u8[src]

Returns the grid position the car started the race in.

pub fn driver_status(&self) -> DriverStatus[src]

Returns the status of the driver.

pub fn result_status(&self) -> ResultStatus[src]

Returns the status of the race results.

Trait Implementations

impl Clone for Lap[src]

impl Copy for Lap[src]

impl Debug for Lap[src]

impl Default for Lap[src]

impl PartialEq<Lap> for Lap[src]

impl PartialOrd<Lap> for Lap[src]

impl StructuralPartialEq for Lap[src]

Auto Trait Implementations

impl RefUnwindSafe for Lap

impl Send for Lap

impl Sync for Lap

impl Unpin for Lap

impl UnwindSafe for Lap

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, 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.