pub struct Velocity(/* private fields */);Expand description
A velocity quantity, stored canonically in meters per second (m/s).
§Construction
use space_units::prelude::*;
let v = Velocity::from_kmps(7.8);
let v2 = 7.8.kmps(); // NumericExt shorthand§Supported units
| Constructor | Accessor | Unit |
|---|---|---|
from_mps | in_mps | meter/second (m/s) |
from_kmps | in_kmps | kilometer/second (km/s) |
from_kmph | in_kmph | kilometer/hour (km/h) |
from_kn | in_kn | knot (kn) |
from_au_per_day | in_au_per_day | AU per day (AU/d) |
from_ftps | in_ftps | foot/second (ft/s) |
§Typed arithmetic
Velocity×Time→LengthVelocity/Time→AccelerationVelocity×Mass→MomentumVelocity×Length→SpecificAngularMomentumVelocity×Velocity→SpecificEnergyVelocity×MassFlowRate→Force
Implementations§
Source§impl Velocity
impl Velocity
Sourcepub const fn from_kmps(val: f64) -> Self
pub const fn from_kmps(val: f64) -> Self
Create from kilometers per second. 1 km/s = 1 000 m/s.
Sourcepub const fn from_au_per_day(val: f64) -> Self
pub const fn from_au_per_day(val: f64) -> Self
Create from astronomical units per day. 1 AU/d = 1 731 456.8 m/s.
Sourcepub const fn in_au_per_day(self) -> f64
pub const fn in_au_per_day(self) -> f64
Get value in astronomical units per day.
Sourcepub fn in_unit(self, unit: VelocityUnit) -> f64
pub fn in_unit(self, unit: VelocityUnit) -> f64
Get value in the specified VelocityUnit.
Sourcepub fn display_as(self, unit: VelocityUnit) -> DisplayWithUnit
pub fn display_as(self, unit: VelocityUnit) -> DisplayWithUnit
Return a DisplayWithUnit for formatted printing in the given unit.
Trait Implementations§
Source§impl AddAssign for Velocity
impl AddAssign for Velocity
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl Div<Time> for Velocity
impl Div<Time> for Velocity
Source§type Output = Acceleration
type Output = Acceleration
The resulting type after applying the
/ operator.Source§impl Div<Velocity> for Force
impl Div<Velocity> for Force
Source§type Output = MassFlowRate
type Output = MassFlowRate
The resulting type after applying the
/ operator.Source§impl DivAssign<f64> for Velocity
impl DivAssign<f64> for Velocity
Source§fn div_assign(&mut self, rhs: f64)
fn div_assign(&mut self, rhs: f64)
Performs the
/= operation. Read moreSource§impl Mul<Length> for Velocity
impl Mul<Length> for Velocity
Source§type Output = SpecificAngularMomentum
type Output = SpecificAngularMomentum
The resulting type after applying the
* operator.Source§impl Mul<MassFlowRate> for Velocity
impl Mul<MassFlowRate> for Velocity
Source§impl Mul<Velocity> for Length
impl Mul<Velocity> for Length
Source§type Output = SpecificAngularMomentum
type Output = SpecificAngularMomentum
The resulting type after applying the
* operator.Source§impl Mul<Velocity> for MassFlowRate
impl Mul<Velocity> for MassFlowRate
Source§impl Mul for Velocity
impl Mul for Velocity
Source§type Output = SpecificEnergy
type Output = SpecificEnergy
The resulting type after applying the
* operator.Source§fn mul(self, rhs: Self) -> SpecificEnergy
fn mul(self, rhs: Self) -> SpecificEnergy
Performs the
* operation. Read moreSource§impl MulAssign<f64> for Velocity
impl MulAssign<f64> for Velocity
Source§fn mul_assign(&mut self, rhs: f64)
fn mul_assign(&mut self, rhs: f64)
Performs the
*= operation. Read moreSource§impl PartialOrd for Velocity
impl PartialOrd for Velocity
Source§impl SubAssign for Velocity
impl SubAssign for Velocity
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreimpl Copy for Velocity
impl StructuralPartialEq for Velocity
Auto Trait Implementations§
impl Freeze for Velocity
impl RefUnwindSafe for Velocity
impl Send for Velocity
impl Sync for Velocity
impl Unpin for Velocity
impl UnsafeUnpin for Velocity
impl UnwindSafe for Velocity
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