pub struct Crank { /* private fields */ }Expand description
A crank’s notches (see the module docs).
Implementations§
Source§impl Crank
impl Crank
Sourcepub fn new(def: CrankDef) -> Self
pub fn new(def: CrankDef) -> Self
A crank with nothing wound yet, def.notch_degrees to the notch.
Sourcepub fn turn(&mut self, degrees: f32) -> Notches
pub fn turn(&mut self, degrees: f32) -> Notches
The crank turned degrees since the last call (forwards is
positive: clockwise on a Playdate). Returns the notches that turn
completes; the rest of a notch counts towards the next call in the
same direction. A reading that isn’t a number counts as no turn.
Sourcepub fn turn_steps(&mut self, steps: i32) -> Notches
pub fn turn_steps(&mut self, steps: i32) -> Notches
The crank turned steps since the last call, STEPS_PER_TURN to
the turn, as turn takes degrees.
Sourcepub fn presses(notches: Notches) -> Option<(Button, u32)>
pub fn presses(notches: Notches) -> Option<(Button, u32)>
The button notches press, and how many times: Button::CrankBack
for notches backwards, Button::CrankForward forwards; None
for none.
Trait Implementations§
impl Copy for Crank
impl Eq for Crank
impl StructuralPartialEq for Crank
Auto Trait Implementations§
impl Freeze for Crank
impl RefUnwindSafe for Crank
impl Send for Crank
impl Sync for Crank
impl Unpin for Crank
impl UnsafeUnpin for Crank
impl UnwindSafe for Crank
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