pub struct Velocity {
pub x: f32,
pub y: f32,
}Expand description
2D velocity component
Fields§
§x: f32X velocity
y: f32Y velocity
Implementations§
Source§impl Velocity
impl Velocity
Sourcepub fn normalized(self) -> Self
pub fn normalized(self) -> Self
Normalizes the velocity to unit length, or returns zero if magnitude is zero
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Velocity
impl<'de> Deserialize<'de> for Velocity
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 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 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