From 0827c40a265adc4ffc143e96ecb5627618b2f68e Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 19 Apr 2017 16:35:07 -0500 Subject: remove the _mut methods they are too limited --- src/lib.rs | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index eef735a..eec40e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ use cortex_m::ctxt::Context; use cortex_m::interrupt::Nr; #[cfg(not(thumbv6m))] use cortex_m::register::{basepri, basepri_max}; -use static_ref::{Ref, RefMut}; +use static_ref::Ref; use typenum::{Cmp, Equal, Unsigned}; #[cfg(not(thumbv6m))] use typenum::{Greater, Less}; @@ -87,18 +87,6 @@ impl Resource> { unsafe { Ref::new(&*self.data.get()) } } - /// Like [Resource.claim](struct.Resource.html#method.claim) but returns a - /// `&mut-` reference - pub fn claim_mut<'task, PRIORITY>( - &'static self, - _priority: &'task mut P, - ) -> RefMut<'task, T> - where - CEILING: Cmp, - { - unsafe { RefMut::new(&mut *self.data.get()) } - } - /// Locks the resource for the duration of the critical section `f` /// /// For the duration of the critical section, tasks whose priority level is @@ -124,28 +112,6 @@ impl Resource> { ret } } - - /// Like [Resource.lock](struct.Resource.html#method.lock) but returns a - /// `&mut-` reference - /// - /// This method has additional an additional constraint: you can't borrow a - /// resource that has ceiling equal `CEILING`. This constraint is required - /// to preserve Rust aliasing rules. - #[cfg(not(thumbv6m))] - pub fn lock_mut(&'static self, _priority: &mut P, f: F) -> R - where F: FnOnce(RefMut) -> R, - CEILING: Cmp + Cmp + Level - { - unsafe { - let old_basepri = basepri::read(); - basepri_max::write(::hw()); - barrier!(); - let ret = f(RefMut::new(&mut *self.data.get())); - barrier!(); - basepri::write(old_basepri); - ret - } - } } unsafe impl Sync for Resource -- cgit v1.2.3