#[repr(C)]pub struct Fuel {
pub fuel_type: FuelType,
pub mass: Mass,
}Expand description
Fuel quantity with a specific type and mass.
Represents a quantity of fuel, tracking both the fuel type and mass. Fuel quantities can be created from either mass or volume, and converted between the two at ISA conditions.
§Examples
// Create fuel from volume
let fuel = Fuel::from_volume(Volume::l(100.0), FuelType::Diesel);
// Create fuel from mass
let fuel = Fuel::new(Mass::kg(83.8), FuelType::Diesel);
// Add fuel quantities
let total = Fuel::from_volume(Volume::l(50.0), FuelType::Diesel)
+ Fuel::from_volume(Volume::l(50.0), FuelType::Diesel);
assert_eq!(total.volume(), Volume::l(100.0));Fields§
§fuel_type: FuelType§mass: MassImplementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Fuel
impl<'de> Deserialize<'de> for Fuel
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Fuel
impl Eq for Fuel
impl StructuralPartialEq for Fuel
Auto Trait Implementations§
impl Freeze for Fuel
impl RefUnwindSafe for Fuel
impl Send for Fuel
impl Sync for Fuel
impl Unpin for Fuel
impl UnsafeUnpin for Fuel
impl UnwindSafe for Fuel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more