Skip to content

Commit 58c89e9

Browse files
committed
Add common trait implementations for publis structs
1 parent 3464cbe commit 58c89e9

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ Versioning](https://semver.org/spec/v2.0.0.html).
1010

1111
## v0.5.0
1212

13-
- Fix lsgpio example to output gpio line flags
14-
- Add `is_empty()` function for `Lines` struct
13+
- Fix lsgpio example to output gpio line flags.
14+
- Add `is_empty()` function for `Lines` struct.
15+
- Add common trait implementations for public structures.
1516
- Update Tokio to 1.x. #[55]((https://github.com/rust-embedded/gpio-cdev/pull/55).
1617
- Breaking change of `LineEventHandle::get_event()` which now expects `&mut self`.
17-
- MSRV is now 1.46.0
18+
- MSRV is now 1.46.0.
1819
- Updated `nix` to version `0.22`.
1920
- Updated `quicli` to version `0.4`.
2021
- Updated `bitflags` to version `1.3`.

src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ mod async_tokio;
107107
pub mod errors; // pub portion is deprecated
108108
mod ffi;
109109

110-
#[derive(Debug)]
110+
#[derive(Debug, Clone, Copy, PartialEq)]
111111
pub enum IoctlKind {
112112
ChipInfo,
113113
LineInfo,
@@ -168,6 +168,8 @@ pub struct Chip {
168168
inner: Arc<InnerChip>,
169169
}
170170

171+
/// Iterator over chips
172+
#[derive(Debug)]
171173
pub struct ChipIterator {
172174
readdir: ReadDir,
173175
}
@@ -297,6 +299,7 @@ impl Chip {
297299
}
298300

299301
/// Iterator over GPIO Lines for a given chip.
302+
#[derive(Debug)]
300303
pub struct LineIterator {
301304
chip: Arc<InnerChip>,
302305
idx: u32,
@@ -388,7 +391,7 @@ bitflags! {
388391
}
389392

390393
/// In or Out
391-
#[derive(Debug, PartialEq)]
394+
#[derive(Debug, Clone, Copy, PartialEq)]
392395
pub enum LineDirection {
393396
In,
394397
Out,
@@ -893,7 +896,7 @@ impl AsRawFd for MultiLineHandle {
893896
/// Maps to kernel [`GPIOEVENT_EVENT_*`] definitions.
894897
///
895898
/// [`GPIOEVENT_EVENT_*`]: https://elixir.bootlin.com/linux/v4.9.127/source/include/uapi/linux/gpio.h#L136
896-
#[derive(Debug, PartialEq)]
899+
#[derive(Debug, Clone, Copy, PartialEq)]
897900
pub enum EventType {
898901
RisingEdge,
899902
FallingEdge,

0 commit comments

Comments
 (0)