pub struct LeverForce {
pub force: f64,
pub lever_arm: f64,
}Expand description
A force applied at a lever arm.
Fields§
§force: f64Applied force in newtons.
lever_arm: f64Lever arm in meters.
Implementations§
Source§impl LeverForce
impl LeverForce
Sourcepub const fn new(force: f64, lever_arm: f64) -> Option<Self>
pub const fn new(force: f64, lever_arm: f64) -> Option<Self>
Creates a lever-force pair from finite values.
Returns None when either input is not finite.
Sourcepub fn torque(&self) -> Option<f64>
pub fn torque(&self) -> Option<f64>
Computes torque for this force and lever arm.
§Examples
use use_torque::LeverForce;
let lever = LeverForce::new(10.0, 2.0).unwrap();
assert_eq!(lever.torque(), Some(20.0));Sourcepub fn torque_at_angle(&self, angle_radians: f64) -> Option<f64>
pub fn torque_at_angle(&self, angle_radians: f64) -> Option<f64>
Computes torque for this force and lever arm at an angle in radians.
Trait Implementations§
Source§impl Clone for LeverForce
impl Clone for LeverForce
Source§fn clone(&self) -> LeverForce
fn clone(&self) -> LeverForce
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LeverForce
impl Debug for LeverForce
Source§impl PartialEq for LeverForce
impl PartialEq for LeverForce
Source§fn eq(&self, other: &LeverForce) -> bool
fn eq(&self, other: &LeverForce) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for LeverForce
impl StructuralPartialEq for LeverForce
Auto Trait Implementations§
impl Freeze for LeverForce
impl RefUnwindSafe for LeverForce
impl Send for LeverForce
impl Sync for LeverForce
impl Unpin for LeverForce
impl UnsafeUnpin for LeverForce
impl UnwindSafe for LeverForce
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