pub struct RefMut<'r, T>(pub &'r mut T);
Expand description
Generic wrapper around a mutable reference
This is used as a means of implementing traits that are already implemented
for T
for &mut T
too. While this is redundant for the traits from this
crate, we couldn’t do this for embedded_hal::timer::CountDown
without a
crate-local type.
The purpose of this is to make the future types more flexible, making it possible to move types into them, or just provide mutable references.
Tuple Fields
0: &'r mut T
Trait Implementations
sourceimpl<'r, T> MotionControl for RefMut<'r, T> where
T: MotionControl,
impl<'r, T> MotionControl for RefMut<'r, T> where
T: MotionControl,
type Velocity = <T as MotionControl>::Velocity
type Velocity = <T as MotionControl>::Velocity
The type used by the driver to represent velocity
type Error = <T as MotionControl>::Error
type Error = <T as MotionControl>::Error
The type error that can happen when using this trait
sourcefn move_to_position(
&mut self,
max_velocity: Self::Velocity,
target_step: i32
) -> Result<(), Self::Error>
fn move_to_position(
&mut self,
max_velocity: Self::Velocity,
target_step: i32
) -> Result<(), Self::Error>
Move to the given position Read more
sourceimpl<'r, T> SetDirection for RefMut<'r, T> where
T: SetDirection,
impl<'r, T> SetDirection for RefMut<'r, T> where
T: SetDirection,
sourceconst SETUP_TIME: Nanoseconds = T::SETUP_TIME
const SETUP_TIME: Nanoseconds = T::SETUP_TIME
The time that the DIR signal must be held for a change to apply
type Dir = <T as SetDirection>::Dir
type Dir = <T as SetDirection>::Dir
The type of the DIR pin
type Error = <T as SetDirection>::Error
type Error = <T as SetDirection>::Error
The error that can occur while accessing the DIR pin
sourceimpl<'r, T> SetStepMode for RefMut<'r, T> where
T: SetStepMode,
impl<'r, T> SetStepMode for RefMut<'r, T> where
T: SetStepMode,
sourceconst SETUP_TIME: Nanoseconds = T::SETUP_TIME
const SETUP_TIME: Nanoseconds = T::SETUP_TIME
The time the mode signals need to be held before re-enabling the driver
sourceconst HOLD_TIME: Nanoseconds = T::HOLD_TIME
const HOLD_TIME: Nanoseconds = T::HOLD_TIME
The time the mode signals need to be held after re-enabling the driver
type Error = <T as SetStepMode>::Error
type Error = <T as SetStepMode>::Error
The error that can occur while using this trait
type StepMode = <T as SetStepMode>::StepMode
type StepMode = <T as SetStepMode>::StepMode
The type that defines the microstepping mode Read more
sourcefn apply_mode_config(
&mut self,
step_mode: Self::StepMode
) -> Result<(), Self::Error>
fn apply_mode_config(
&mut self,
step_mode: Self::StepMode
) -> Result<(), Self::Error>
Apply the new step mode configuration Read more
sourcefn enable_driver(&mut self) -> Result<(), Self::Error>
fn enable_driver(&mut self) -> Result<(), Self::Error>
Re-enable the driver after the mode has been set
sourceimpl<'r, T> Step for RefMut<'r, T> where
T: Step,
impl<'r, T> Step for RefMut<'r, T> where
T: Step,
sourceconst PULSE_LENGTH: Nanoseconds = T::PULSE_LENGTH
const PULSE_LENGTH: Nanoseconds = T::PULSE_LENGTH
The minimum length of a STEP pulse
sourceimpl<'r, T, const TIMER_HZ: u32> Timer<TIMER_HZ> for RefMut<'r, T> where
T: Timer<TIMER_HZ>,
impl<'r, T, const TIMER_HZ: u32> Timer<TIMER_HZ> for RefMut<'r, T> where
T: Timer<TIMER_HZ>,
sourcefn now(&mut self) -> TimerInstant<TIMER_HZ>
fn now(&mut self) -> TimerInstant<TIMER_HZ>
Return current time Instant
sourcefn start(&mut self, duration: TimerDuration<TIMER_HZ>) -> Result<(), Self::Error>
fn start(&mut self, duration: TimerDuration<TIMER_HZ>) -> Result<(), Self::Error>
Start timer with a duration
Auto Trait Implementations
impl<'r, T> RefUnwindSafe for RefMut<'r, T> where
T: RefUnwindSafe,
impl<'r, T> Send for RefMut<'r, T> where
T: Send,
impl<'r, T> Sync for RefMut<'r, T> where
T: Sync,
impl<'r, T> Unpin for RefMut<'r, T>
impl<'r, T> !UnwindSafe for RefMut<'r, T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcefn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
sourcefn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
sourceimpl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
sourcefn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
sourceimpl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
sourcefn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
sourceimpl<T> OverflowingAs for T
impl<T> OverflowingAs for T
sourcefn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
sourcefn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
sourceimpl<T> SaturatingAs for T
impl<T> SaturatingAs for T
sourcefn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
sourcefn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
sourcefn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
sourcefn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<T> WrappingAs for T
impl<T> WrappingAs for T
sourcefn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
sourcefn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.