Struct embedded_hal_sync_pins::pins::InputPin [−][src]
A mutable input pin that can be safely shared between threads.
This pin implements embedded_hal::InputPin and can be used
to share an AtomicPinState with an embedded_hal implementation.
Examples
use embedded_hal_sync_pins::pins::{AtomicPinState, InputPin, PinState}; use embedded_hal::digital::InputPin as HalInputPin; use std::sync::{Arc, atomic::Ordering}; let state = Arc::new(AtomicPinState::new_with_state(PinState::Low)); let pin = InputPin::new(state.clone()); assert_eq!(Ok(true), pin.try_is_low()); state.store(PinState::High, Ordering::SeqCst); assert_eq!(Ok(true), pin.try_is_high());
Implementations
impl InputPin[src]
pub fn new(state: Arc<AtomicPinState>) -> Self[src]
Creates a new input pin with a given PinState.
Trait Implementations
impl Clone for InputPin[src]
impl Debug for InputPin[src]
impl InputPin for InputPin[src]
type Error = Infallible
Error type
fn try_is_high(&self) -> Result<bool, Self::Error>[src]
fn try_is_low(&self) -> Result<bool, Self::Error>[src]
Auto Trait Implementations
impl RefUnwindSafe for InputPin[src]
impl Send for InputPin[src]
impl Sync for InputPin[src]
impl Unpin for InputPin[src]
impl UnwindSafe for InputPin[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,