Skip to content

Commit

Permalink
impl From for async wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
warthog618 committed Feb 11, 2024
1 parent 7a9d142 commit 8803caf
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Each crate has its own detailed CHANGELOG:
## [Unreleased](https://github.com/warthog618/gpiocdev-rs/compare/lib-v0.6.1...HEAD)

- fix issue #14 - drop Timestamp class and chrono dependency from lib.
- impl From for async wrappers

## 2023-11-22

Expand Down
1 change: 1 addition & 0 deletions lib/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- assume /dev/gpiochipXX are valid gpiochips without explicit checking
- fix issue #14 - drop Timestamp class and dependency on chrono - was only for CLOCK_REALTIME helper.
- impl From for async wrappers

<a name="v0.6.1"></a>

Expand Down
12 changes: 12 additions & 0 deletions lib/src/async/async_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ impl AsRef<Chip> for AsyncChip {
}
}

impl From<AsyncChip> for Chip {
fn from(c: AsyncChip) -> Chip {
c.0.into_inner()
}
}

/// Async form of [`InfoChangeIterator`].
///
/// Created by [`AsyncChip::info_change_events`].
Expand Down Expand Up @@ -269,6 +275,12 @@ impl AsRef<Request> for AsyncRequest {
}
}

impl From<AsyncRequest> for Request {
fn from(r: AsyncRequest) -> Request {
r.0.into_inner()
}
}

/// Async form of [`EdgeEventBuffer`] in its role as an iterator.
///
/// Created by [`AsyncRequest::new_edge_event_stream`] or [`AsyncRequest::edge_events`].
Expand Down
12 changes: 12 additions & 0 deletions lib/src/async/tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ impl AsRef<Chip> for AsyncChip {
}
}

impl From<AsyncChip> for Chip {
fn from(c: AsyncChip) -> Chip {
c.0.into_inner()
}
}

/// Async form of [`InfoChangeIterator`].
///
/// Created by [`AsyncChip::info_change_events`].
Expand Down Expand Up @@ -283,6 +289,12 @@ impl AsRef<Request> for AsyncRequest {
}
}

impl From<AsyncRequest> for Request {
fn from(r: AsyncRequest) -> Request {
r.0.into_inner()
}
}

/// Async form of [`EdgeEventBuffer`] in its role as an iterator.
///
/// Created by [`AsyncRequest::new_edge_event_stream`] or [`AsyncRequest::edge_events`].
Expand Down

0 comments on commit 8803caf

Please sign in to comment.