From c6bf89a31874839f22f9de823f874133b9746ce3 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Fri, 14 Apr 2017 00:33:07 -0500 Subject: remove unnecessary trait bounds --- src/lib.rs | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 3914474..07f1e6c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,6 @@ +//! Stack Resource Policy + +#![deny(missing_docs)] #![deny(warnings)] #![feature(asm)] #![feature(const_fn)] @@ -52,10 +55,7 @@ impl Resource { } } -impl Resource> -where - C: Ceiling, -{ +impl Resource> { /// Borrows the resource for the duration of another resource's critical /// section /// @@ -68,7 +68,6 @@ where where SCEILING: GreaterThanOrEqual, CEILING: GreaterThanOrEqual, - P: Priority, { unsafe { &*self.data.get() } } @@ -82,7 +81,6 @@ where ) -> &'task T where CEILING: Cmp, - P: Priority, { unsafe { &*self.data.get() } } @@ -95,7 +93,6 @@ where ) -> &'task mut T where CEILING: Cmp, - P: Priority, { unsafe { &mut *self.data.get() } } @@ -117,10 +114,8 @@ where ) -> R where F: FnOnce(&T, C) -> R, - C: Ceiling, CEILING: Cmp + Cmp + Level, - P: Priority, { unsafe { let old_basepri = basepri::read(); @@ -147,10 +142,8 @@ where ) -> R where F: FnOnce(&mut T) -> R, - C: Ceiling, CEILING: Cmp + Cmp + Level, - P: Priority, { unsafe { let old_basepri = basepri::read(); @@ -164,9 +157,9 @@ where } } -unsafe impl Sync for Resource +unsafe impl Sync for Resource where - CEILING: Ceiling, + C: Ceiling, { } @@ -197,10 +190,7 @@ where } } -impl Peripheral> -where - C: Ceiling, -{ +impl Peripheral> { /// See [Resource.borrow](./struct.Resource.html#method.borrow) pub fn borrow<'cs, PRIORITY, SCEILING>( &'static self, @@ -221,7 +211,6 @@ where ) -> &'task Periph where CEILING: Cmp, - P: Priority, { unsafe { &*self.peripheral.get() } } @@ -235,10 +224,8 @@ where ) -> R where F: FnOnce(&Periph, C) -> R, - C: Ceiling, CEILING: Cmp + Cmp + Level, - P: Priority, { unsafe { let old_basepri = basepri::read(); @@ -279,7 +266,7 @@ where r } -/// Requests the execution of the task `task` +/// Requests the execution of a `task` pub fn request(_task: fn(T, P)) where T: Context + Nr, @@ -320,12 +307,13 @@ impl P where T: Level, { + #[doc(hidden)] pub fn hw() -> u8 { T::hw() } } -/// A valid ceiling +/// A valid resource ceiling /// /// DO NOT IMPLEMENT THIS TRAIT YOURSELF pub unsafe trait Ceiling {} @@ -339,10 +327,11 @@ pub unsafe trait GreaterThanOrEqual {} /// /// DO NOT IMPLEMENT THIS TRAIT YOURSELF pub unsafe trait Level { + /// Interrupt hardware level fn hw() -> u8; } -/// A valid priority level +/// A valid task priority /// /// DO NOT IMPLEMENT THIS TRAIT YOURSELF pub unsafe trait Priority {} @@ -354,8 +343,6 @@ fn logical2hw(logical: u8) -> u8 { /// Priority 0, the lowest priority pub type P0 = P<::typenum::U0>; -unsafe impl Priority for P0 {} - /// Declares tasks #[macro_export] macro_rules! tasks { -- cgit v1.2.3