Skip to content

Commit

Permalink
Make Qei methods fallible
Browse files Browse the repository at this point in the history
  • Loading branch information
eldruin committed Mar 11, 2020
1 parent f4e776c commit 16bd944
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -974,14 +974,17 @@ pub trait PwmPin {
// reason: needs to be re-evaluated in the new singletons world. At the very least this needs a
// reference implementation
pub trait Qei {
/// Enumeration of `Qei` errors
type Error;

/// The type of the value returned by `count`
type Count;

/// Returns the current pulse count of the encoder
fn count(&self) -> Self::Count;
fn count(&self) -> Result<Self::Count, Self::Error>;

/// Returns the count direction
fn direction(&self) -> Direction;
fn direction(&self) -> Result<Direction, Self::Error>;
}

/// Count direction
Expand Down

0 comments on commit 16bd944

Please sign in to comment.