Struct Options

Source
pub struct Options<Direction = (), Lines = (), Consumer = ()> { /* private fields */ }
Expand description

GPIO line values request options

Input config:

let input = Options::input(&[23, 17, 3])
    .active(Active::Low)
    .bias(Bias::PullUp)
    .consumer("my inputs");

Output config:

let output = Options::output(&[11, 20])
    .active(Active::Low)
    .drive(Drive::PushPull)
    .values([false, true])
    .consumer("my outputs");

Input with edge detection:

let input = Options::input(&[21, 13])
    .active(Active::Low)
    .bias(Bias::PullUp)
    .edge(EdgeDetect::Both)
    .consumer("my inputs");

Implementations§

Source§

impl Options

Source

pub fn input<Lines>(lines: Lines) -> Options<Input, Lines, &'static str>
where Lines: AsRef<[u32]>,

Create input options

Source

pub fn output<Lines>(lines: Lines) -> Options<Output, Lines, &'static str>
where Lines: AsRef<[u32]>,

Create output options

Source§

impl<Direction, Lines, OldConsumer> Options<Direction, Lines, OldConsumer>

Source

pub fn consumer<Consumer>( self, consumer: Consumer, ) -> Options<Direction, Lines, Consumer>
where Consumer: AsRef<str>,

Configure consumer string

Source§

impl<Direction, Lines, Consumer> Options<Direction, Lines, Consumer>

Source

pub fn active(self, active: Active) -> Options<Direction, Lines, Consumer>

Configure GPIO lines astive state

Available both for inputs and outputs

Source

pub fn bias(self, bias: Bias) -> Options<Direction, Lines, Consumer>

Configure GPIO lines bias

Available both for inputs and outputs

Source§

impl<Direction, Lines, Consumer> Options<Direction, Lines, Consumer>
where Lines: AsRef<[u32]>, Consumer: AsRef<str>,

Source

pub fn to_owned(&self) -> Options<Direction, Vec<u32>, String>

Make an independent copy of options

Source§

impl<Lines, Consumer> Options<Input, Lines, Consumer>

Source

pub fn edge(self, edge: EdgeDetect) -> Options<Input, Lines, Consumer>

Configure edge detection

Available only for inputs

Source§

impl<Lines, Consumer> Options<Output, Lines, Consumer>

Source

pub fn drive(self, drive: Drive) -> Options<Output, Lines, Consumer>

Configure edge detection

Available only for outputs

Source

pub fn values<T>(self, values: T) -> Options<Output, Lines, Consumer>
where T: AsValues,

Configure default values

Available only for outputs

Auto Trait Implementations§

§

impl<Direction, Lines, Consumer> Freeze for Options<Direction, Lines, Consumer>
where Lines: Freeze, Consumer: Freeze,

§

impl<Direction, Lines, Consumer> RefUnwindSafe for Options<Direction, Lines, Consumer>
where Lines: RefUnwindSafe, Consumer: RefUnwindSafe, Direction: RefUnwindSafe,

§

impl<Direction, Lines, Consumer> Send for Options<Direction, Lines, Consumer>
where Lines: Send, Consumer: Send, Direction: Send,

§

impl<Direction, Lines, Consumer> Sync for Options<Direction, Lines, Consumer>
where Lines: Sync, Consumer: Sync, Direction: Sync,

§

impl<Direction, Lines, Consumer> Unpin for Options<Direction, Lines, Consumer>
where Lines: Unpin, Consumer: Unpin, Direction: Unpin,

§

impl<Direction, Lines, Consumer> UnwindSafe for Options<Direction, Lines, Consumer>
where Lines: UnwindSafe, Consumer: UnwindSafe, Direction: UnwindSafe,

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more