Struct syunit::Velocity

source ·
pub struct Velocity(pub f32);
Expand description

Represents a change in distance over time

§Unit

  • Can be either radians per second or millimeters per second

Tuple Fields§

§0: f32

Implementations§

source§

impl Velocity

source

pub const ZERO: Self = _

Zero value of this unit (0.0)

source

pub const INFINITY: Self = _

Positive Infinity value of this unit (f32::INFINITY)

source

pub const NEG_INFINITY: Self = _

Negative Infinity value of this unit (f32::INFINITY)

source

pub const NAN: Self = _

NaN value of this unit (f32::NAN)

source

pub fn abs(self) -> Self

Returns the absolute value of the unit

source

pub fn is_finite(self) -> bool

Returns true if this units value is neither NaN nor Infinite

source

pub fn is_normal(self) -> bool

Returns true if this units value is neither NaN, Infinite or zero

source

pub fn is_nan(self) -> bool

Returns true if this units value is Nan

source

pub fn powi(self, pow: i32) -> Self

Returns the unit raised to the given integer power pow

source

pub fn powf(self, pow: f32) -> Self

Returns the unit raised to the given power pow

source

pub fn sin(self) -> f32

Returns the sin of this units value

source

pub fn cos(self) -> f32

Returns the cos of this units value

source

pub fn tan(self) -> f32

Returns the tan of this units value

source

pub fn is_sign_negative(self) -> bool

Returns true if the sign bit of this value is negative (value smaller than 0.0, -0.0 included)

source

pub fn is_sign_positive(self) -> bool

Returns true if the sign bit of this value is positive (value smaller than 0.0, -0.0 included)

source

pub fn min(self, other: Self) -> Self

Returns the smaller value of this and another unit

source

pub fn max(self, other: Self) -> Self

Return the bigger value of this and another unit

source

pub fn max_ref<'a>(&'a self, other: &'a Self) -> &'a Self

Return the bigger value of this and another unit, working with references

source

pub fn min_ref<'a>(&'a self, other: &'a Self) -> &'a Self

Return the bigger value of this and another unit, working with references

source

pub fn get_direction(self) -> Direction

Get the direction of the value (positive or negative)

0.0 will be accounted as positive

Trait Implementations§

source§

impl Add for Velocity

§

type Output = Velocity

The resulting type after applying the + operator.
source§

fn add(self, rhs: Velocity) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign for Velocity

source§

fn add_assign(&mut self, rhs: Velocity)

Performs the += operation. Read more
source§

impl Clone for Velocity

source§

fn clone(&self) -> Velocity

Returns a copy 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 Velocity

source§

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

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

impl Default for Velocity

source§

fn default() -> Velocity

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

impl<'de> Deserialize<'de> for Velocity

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Velocity

source§

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

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

impl Div<Acceleration> for Velocity

§

type Output = Time

The resulting type after applying the / operator.
source§

fn div(self, rhs: Acceleration) -> Self::Output

Performs the / operation. Read more
source§

impl Div<Time> for Velocity

§

type Output = Acceleration

The resulting type after applying the / operator.
source§

fn div(self, rhs: Time) -> Self::Output

Performs the / operation. Read more
source§

impl Div<Velocity> for Delta

§

type Output = Time

The resulting type after applying the / operator.
source§

fn div(self, rhs: Velocity) -> Self::Output

Performs the / operation. Read more
source§

impl Div<Velocity> for f32

§

type Output = Time

The resulting type after applying the / operator.
source§

fn div(self, rhs: Velocity) -> Self::Output

Performs the / operation. Read more
source§

impl Div<f32> for Velocity

§

type Output = Velocity

The resulting type after applying the / operator.
source§

fn div(self, rhs: f32) -> Self::Output

Performs the / operation. Read more
source§

impl Div for Velocity

§

type Output = f32

The resulting type after applying the / operator.
source§

fn div(self, rhs: Velocity) -> Self::Output

Performs the / operation. Read more
source§

impl FromStr for Velocity

§

type Err = <f32 as FromStr>::Err

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Into<f32> for Velocity

source§

fn into(self) -> f32

Converts this type into the (usually inferred) input type.
source§

impl Mul<Factor> for Velocity

§

type Output = Velocity

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Factor) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Time> for Velocity

§

type Output = Delta

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Time) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Velocity> for Time

§

type Output = Delta

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Velocity) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Velocity> for f32

§

type Output = Velocity

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Velocity) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<f32> for Velocity

§

type Output = Velocity

The resulting type after applying the * operator.
source§

fn mul(self, rhs: f32) -> Self::Output

Performs the * operation. Read more
source§

impl Neg for Velocity

§

type Output = Velocity

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl PartialEq for Velocity

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Velocity

source§

fn partial_cmp(&self, other: &Velocity) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for Velocity

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Sub for Velocity

§

type Output = Velocity

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Velocity) -> Self::Output

Performs the - operation. Read more
source§

impl SubAssign for Velocity

source§

fn sub_assign(&mut self, rhs: Velocity)

Performs the -= operation. Read more
source§

impl Unit for Velocity

source§

fn new(v: f32) -> Self

Creates a new value of this unit using a f32 value
source§

impl Copy for Velocity

source§

impl StructuralPartialEq for Velocity

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

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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

§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,