Skip to main content

GearTrain

Struct GearTrain 

Source
pub struct GearTrain<'a, E: Copy + Debug> { /* private fields */ }
Expand description

A gear train, a mechanism consisting of a two or more gears meshed together. As this device has only one degree of freedom, it propagates Commands given to its terminals as well as States.

Implementations§

Source§

impl<'a, E: Copy + Debug> GearTrain<'a, E>

Source

pub const fn with_ratio_raw(ratio: f32) -> Self

Construct a GearTrain with the ratio as an f32.

Source

pub const fn with_ratio(ratio: Quantity) -> Self

Construct a GearTrain with the ratio as a dimensionless Quantity.

Source

pub const fn new<const N: usize>(teeth: [f32; N]) -> Self

Construct a GearTrain from an array of the numbers of teeth on each gear in the train.

Source

pub fn get_terminal_1(&self) -> &'a RefCell<Terminal<'a, E>>

Get a reference to the side 1 terminal of the device where (side 1) * ratio = (side 2).

Source

pub fn get_terminal_2(&self) -> &'a RefCell<Terminal<'a, E>>

Get a reference to the side 2 terminal of the device where (side 1) * ratio = (side 2).

Trait Implementations§

Source§

impl<E: Copy + Debug> Device<E> for GearTrain<'_, E>

Source§

fn update_terminals(&mut self) -> NothingOrError<E>

Call only the update methods of owned terminals and do not update anything else with the device.
Source§

impl<E: Copy + Debug> Updatable<E> for GearTrain<'_, E>

Source§

fn update(&mut self) -> NothingOrError<E>

As this trait is very generic, exactly what this does will be very dependent on the implementor.

Auto Trait Implementations§

§

impl<'a, E> !Freeze for GearTrain<'a, E>

§

impl<'a, E> !RefUnwindSafe for GearTrain<'a, E>

§

impl<'a, E> !Send for GearTrain<'a, E>

§

impl<'a, E> !Sync for GearTrain<'a, E>

§

impl<'a, E> Unpin for GearTrain<'a, E>

§

impl<'a, E> UnsafeUnpin for GearTrain<'a, E>

§

impl<'a, E> !UnwindSafe for GearTrain<'a, E>

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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.