Skip to content

Commit 62a417a

Browse files
committed
riscv-pac: use Result type for traits
Uses the new `Result` type for library traits.
1 parent 77b692f commit 62a417a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

riscv-pac/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
pub mod result;
44

5+
use result::Result;
6+
57
/// Trait for enums of target-specific external interrupt numbers.
68
///
79
/// This trait should be implemented by a peripheral access crate (PAC)
@@ -25,7 +27,7 @@ pub unsafe trait InterruptNumber: Copy {
2527

2628
/// Tries to convert a number to a valid interrupt source.
2729
/// If the conversion fails, it returns an error with the number back.
28-
fn from_number(value: u16) -> Result<Self, u16>;
30+
fn from_number(value: u16) -> Result<Self>;
2931
}
3032

3133
/// Trait for enums of priority levels.
@@ -51,7 +53,7 @@ pub unsafe trait PriorityNumber: Copy {
5153

5254
/// Tries to convert a number to a valid priority level.
5355
/// If the conversion fails, it returns an error with the number back.
54-
fn from_number(value: u8) -> Result<Self, u8>;
56+
fn from_number(value: u8) -> Result<Self>;
5557
}
5658

5759
/// Trait for enums of HART identifiers.
@@ -77,5 +79,5 @@ pub unsafe trait HartIdNumber: Copy {
7779

7880
/// Tries to convert a number to a valid HART ID.
7981
/// If the conversion fails, it returns an error with the number back.
80-
fn from_number(value: u16) -> Result<Self, u16>;
82+
fn from_number(value: u16) -> Result<Self>;
8183
}

0 commit comments

Comments
 (0)