Trait avr_oxide::devices::UsesPin

source ·
pub trait UsesPin {
    // Required method
    fn using<OP: Into<OwnOrBorrow<'static, dyn Pin>>>(pin: OP) -> Self;

    // Provided methods
    fn with_pin(pin: &'static dyn Pin) -> Self
       where Self: Sized { ... }
    fn static_using<OP: Into<OwnOrBorrow<'static, dyn Pin>>>(
        pin: OP
    ) -> &'static mut Self
       where Self: Sized { ... }
    fn static_with_pin(pin: &'static dyn Pin) -> &'static mut Self
       where Self: Sized { ... }
}
Expand description

Convenience trait implemented by any devices that use (and are constructed with) an I/O pin.

Required Methods§

source

fn using<OP: Into<OwnOrBorrow<'static, dyn Pin>>>(pin: OP) -> Self

Create an instance of this device that uses the given instance of a pin (by ownership or reference.)

Provided Methods§

source

fn with_pin(pin: &'static dyn Pin) -> Self
where Self: Sized,

Convenience method to create an instance of this device with a given static reference to a pin (avoids a certain amount of type hinting boilerplate for the caller.)

source

fn static_using<OP: Into<OwnOrBorrow<'static, dyn Pin>>>( pin: OP ) -> &'static mut Self
where Self: Sized,

Create an instance of this device that uses the given instance of a pin, and return a static reference good for the lifetime of the program.

§Note

This method leaks memory, deliberately - the create instance will never be freed. In our intended embedded environment, this is entirely deliberate.

source

fn static_with_pin(pin: &'static dyn Pin) -> &'static mut Self
where Self: Sized,

Create an instance of this device that uses the given reference to a pin, and return a static reference good for the lifetime of the program.

§Note

This method leaks memory, deliberately - the create instance will never be freed. In our intended embedded environment, this is entirely deliberate.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl UsesPin for Debouncer

source§

impl UsesPin for Inverter

source§

impl UsesPin for Led

source§

impl<'b, S> UsesPin for Button<'b, S>
where S: 'static + EventSink,