1
- //! Abstractions common to bare metal systems
1
+ //! Abstractions common to bare metal systems.
2
2
3
3
#![ deny( missing_docs) ]
4
4
#![ deny( warnings) ]
7
7
use core:: cell:: UnsafeCell ;
8
8
use core:: marker:: PhantomData ;
9
9
10
- /// Critical section token
10
+ /// Critical section token.
11
11
///
12
- /// Indicates that you are executing code within a critical section
12
+ /// Indicates that you are executing code within a critical section.
13
13
#[ derive( Clone , Copy ) ]
14
14
pub struct CriticalSection < ' cs > {
15
15
_0 : PhantomData < & ' cs ( ) > ,
16
16
}
17
17
18
18
impl < ' cs > CriticalSection < ' cs > {
19
- /// Creates a critical section token
19
+ /// Creates a critical section token.
20
20
///
21
21
/// This method is meant to be used to create safe abstractions rather than
22
22
/// meant to be directly used in applications.
@@ -26,7 +26,7 @@ impl<'cs> CriticalSection<'cs> {
26
26
}
27
27
}
28
28
29
- /// A "mutex" based on critical sections
29
+ /// A "mutex" based on critical sections.
30
30
///
31
31
/// # Safety
32
32
///
@@ -38,7 +38,7 @@ pub struct Mutex<T> {
38
38
}
39
39
40
40
impl < T > Mutex < T > {
41
- /// Creates a new mutex
41
+ /// Creates a new mutex.
42
42
pub const fn new ( value : T ) -> Self {
43
43
Mutex {
44
44
inner : UnsafeCell :: new ( value) ,
@@ -47,7 +47,7 @@ impl<T> Mutex<T> {
47
47
}
48
48
49
49
impl < T > Mutex < T > {
50
- /// Borrows the data for the duration of the critical section
50
+ /// Borrows the data for the duration of the critical section.
51
51
pub fn borrow < ' cs > ( & ' cs self , _cs : CriticalSection < ' cs > ) -> & ' cs T {
52
52
unsafe { & * self . inner . get ( ) }
53
53
}
@@ -67,8 +67,8 @@ unsafe impl<T> Sync for Mutex<T> where T: Send {}
67
67
#[ allow( dead_code) ]
68
68
const GH_6 : ( ) = ( ) ;
69
69
70
- /// Interrupt number
70
+ /// Interrupt number.
71
71
pub unsafe trait Nr {
72
- /// Returns the number associated with an interrupt
72
+ /// Returns the number associated with an interrupt.
73
73
fn nr ( & self ) -> u8 ;
74
74
}
0 commit comments