Struct gpiocdev::line::Values

source ·
pub struct Values(/* private fields */);
Expand description

A collection of line values.

Lines are identified by their offset.

Implementations§

source§

impl Values

source

pub fn get(&self, offset: Offset) -> Option<Value>

Get the value of a line.

source

pub fn set(&mut self, offset: Offset, value: Value) -> &mut Self

Set the value of a line.

source

pub fn not(&mut self) -> &mut Self

Toggle all values.

source

pub fn toggle(&mut self, offset: Offset)

Toggle the value of a line.

If not already set then sets the line active.

source

pub fn unset(&mut self, offset: Offset)

Remove any value setting for a line.

source

pub fn len(&self) -> usize

The number of lines for which values are contained in this set.

source

pub fn is_empty(&self) -> bool

Return true if the values is empty.

source

pub fn from_offsets(offsets: &[Offset]) -> Values

Construct a Values collection for a set of line offsets.

Typically used to create a values template to be populated via a call to crate::Request::values().

All lines are set to inactive.

source

pub fn iter(&self) -> Iter<'_, LineValue>

An iterator to visit all values.

source

pub fn iter_mut(&mut self) -> IterMut<'_, LineValue>

An mutating iterator to visit all values.

Trait Implementations§

source§

impl Debug for Values

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Values

source§

fn default() -> Values

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Values

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<'a> FromIterator<&'a u32> for Values

source§

fn from_iter<I: IntoIterator<Item = &'a Offset>>(iter: I) -> Self

Creates a value from an iterator. Read more
source§

impl FromIterator<(u32, Value)> for Values

source§

fn from_iter<I: IntoIterator<Item = (Offset, Value)>>(iter: I) -> Self

Creates a value from an iterator. Read more
source§

impl PartialEq for Values

source§

fn eq(&self, other: &Values) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Values

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for Values

source§

impl StructuralPartialEq for Values

Auto Trait Implementations§

§

impl Freeze for Values

§

impl RefUnwindSafe for Values

§

impl Send for Values

§

impl Sync for Values

§

impl Unpin for Values

§

impl UnwindSafe for Values

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

§

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

§

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
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,