Struct InfoRef

Source
pub struct InfoRef { /* private fields */ }
Expand description

Line info reference

Exposes functions for retrieving kernel information about both requested and free lines. Line info object contains an immutable snapshot of a line’s status.

The line info contains all the publicly available information about a line, which does not include the line value. The line must be requested to access the line value.

InfoRef only abstracts a reference to a [gpiod::gpiod_line_info] instance whose lifetime is managed by a different object instance. The owned counter-part of this type is Info.

Implementations§

Source§

impl InfoRef

Source

pub fn try_clone(&self) -> Result<Info>

Clones the line info object.

Source

pub fn offset(&self) -> Offset

Get the offset of the line within the GPIO chip.

The offset uniquely identifies the line on the chip. The combination of the chip and offset uniquely identifies the line within the system.

Source

pub fn name(&self) -> Result<&str>

Get GPIO line’s name.

Source

pub fn is_used(&self) -> bool

Returns True if the line is in use, false otherwise.

The user space can’t know exactly why a line is busy. It may have been requested by another process or hogged by the kernel. It only matters that the line is used and we can’t request it.

Source

pub fn consumer(&self) -> Result<&str>

Get the GPIO line’s consumer name.

Source

pub fn direction(&self) -> Result<Direction>

Get the GPIO line’s direction.

Source

pub fn is_active_low(&self) -> bool

Returns true if the line is “active-low”, false otherwise.

Source

pub fn bias(&self) -> Result<Option<Bias>>

Get the GPIO line’s bias setting.

Source

pub fn drive(&self) -> Result<Drive>

Get the GPIO line’s drive setting.

Source

pub fn edge_detection(&self) -> Result<Option<Edge>>

Get the current edge detection setting of the line.

Source

pub fn event_clock(&self) -> Result<EventClock>

Get the current event clock setting used for edge event timestamps.

Source

pub fn is_debounced(&self) -> bool

Returns true if the line is debounced (either by hardware or by the kernel software debouncer), false otherwise.

Source

pub fn debounce_period(&self) -> Duration

Get the debounce period of the line.

Trait Implementations§

Source§

impl Debug for InfoRef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, 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.