CarStatus

Struct CarStatus 

Source
pub struct CarStatus { /* private fields */ }
Expand description

Data describing the status of a car

The status of each car is a collection of properties that can change over time. It includes data about the fuel, the engine, the various assistance systems like ABS, DRS, and ERS, and the damage the car has sustained. In multiplayer sessions, some of this data is restricted and only shown for the player’s own car.

Implementations§

Source§

impl CarStatus

Source

pub fn new( traction_control: TractionControl, abs: bool, fuel_mix: FuelMix, brake_bias: u8, pit_limiter: bool, fuel_remaining: f32, fuel_capacity: f32, fuel_remaining_laps: f32, max_rpm: u16, idle_rpm: u16, gear_count: u8, drs: DrsSetting, tyre_wear: CornerProperty<u8>, physical_tyre_compound: PhysicalTyreCompound, visual_tyre_compound: VisualTyreCompound, tyre_damage: CornerProperty<u8>, front_left_wing_damage: u8, front_right_wing_damage: u8, rear_wing_damage: u8, engine_damage: u8, gear_box_damage: u8, vehicle_flags: Flag, ers_energy: f32, ers_deploy_mode: ErsDeployMode, ers_harvest_mgu_k: f32, ers_harvest_mgu_h: f32, ers_deployed: f32, ) -> Self

Constructs a new CarStatus.

Source§

impl CarStatus

Source

pub fn traction_control(&self) -> TractionControl

Returns the traction control setting.

Source

pub fn abs(&self) -> bool

Returns whether ABS is enabled.

Source

pub fn fuel_mix(&self) -> FuelMix

Returns the fuel mix setting.

Source

pub fn brake_bias(&self) -> u8

Returns the front brake bias (percentage).

Source

pub fn pit_limiter(&self) -> bool

Returns whether the pit speed limiter is engaged.

Source

pub fn fuel_remaining(&self) -> f32

Returns the remaining fuel mass in tank.

Source

pub fn fuel_capacity(&self) -> f32

Returns the fuel capacity.

Source

pub fn fuel_remaining_laps(&self) -> f32

Returns the remaining fuel in terms of laps.

Source

pub fn max_rpm(&self) -> u16

Returns the car’s maximum RPM where the rev limiter kicks in.

Source

pub fn idle_rpm(&self) -> u16

Returns the car’s idle RPM.

Source

pub fn gear_count(&self) -> u8

Returns the car’s number of gears.

Source

pub fn drs(&self) -> DrsSetting

Returns the status of DRS.

Source

pub fn physical_tyre_compound(&self) -> PhysicalTyreCompound

Returns the physical compound of the tyres.

Source

pub fn visual_tyre_compound(&self) -> VisualTyreCompound

Returns the visual compound of the tyres.

Source

pub fn front_left_wing_damage(&self) -> u8

Returns the damage to the left front wing in percent.

Source

pub fn front_right_wing_damage(&self) -> u8

Returns the damage to the right front wing in percent.

Source

pub fn rear_wing_damage(&self) -> u8

Returns the damage to the rear wing in percent.

Source

pub fn engine_damage(&self) -> u8

Returns the damage to the engine in percent.

Source

pub fn gear_box_damage(&self) -> u8

Returns the damage to the gear box in percent.

Source

pub fn vehicle_flags(&self) -> Flag

Returns the flags that are being shown to the current car.

Source

pub fn ers_energy(&self) -> f32

Returns the ERS energy store in Joules.

Source

pub fn ers_deploy_mode(&self) -> ErsDeployMode

Returns the ERS deploy mode.

Source

pub fn ers_harvest_mgu_k(&self) -> f32

Returns the ERS energy harvested this lap by the MGU-K.

Source

pub fn ers_harvest_mgu_h(&self) -> f32

Returns the ERS energy harvested this lap by the MGU-H.

Source

pub fn ers_deployed(&self) -> f32

Returns the ERS energy deployed this lap.

Source§

impl CarStatus

Source

pub fn tyre_wear(&self) -> &CornerProperty<u8>

Returns the tyre wear at each corner of the car in percent.

Source

pub fn tyre_damage(&self) -> &CornerProperty<u8>

Returns the tyre damage at each corner of the car in percent.

Trait Implementations§

Source§

impl Clone for CarStatus

Source§

fn clone(&self) -> CarStatus

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CarStatus

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CarStatus

Source§

fn default() -> CarStatus

Returns the “default value” for a type. Read more
Source§

impl PartialEq for CarStatus

Source§

fn eq(&self, other: &CarStatus) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for CarStatus

Source§

fn partial_cmp(&self, other: &CarStatus) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for CarStatus

Source§

impl StructuralPartialEq for CarStatus

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.