11
11
//! operation, which in situation where counting is actually desired, will result in the count being
12
12
//! incorrect.
13
13
14
+ #[ cfg( CONFIG_RUST_ALLOC ) ]
14
15
use core:: pin:: Pin ;
16
+ #[ cfg( CONFIG_RUST_ALLOC ) ]
15
17
use core:: task:: { Context , Poll } ;
16
- use core:: { ffi:: c_uint, future:: Future } ;
18
+ #[ cfg( CONFIG_RUST_ALLOC ) ]
19
+ use core:: future:: Future ;
20
+ use core:: ffi:: c_uint;
17
21
use core:: fmt;
18
22
#[ cfg( CONFIG_RUST_ALLOC ) ]
19
23
use core:: mem;
20
24
25
+ #[ cfg( CONFIG_RUST_ALLOC ) ]
21
26
use zephyr_sys:: ETIMEDOUT ;
22
27
28
+ #[ cfg( CONFIG_RUST_ALLOC ) ]
23
29
use crate :: time:: NoWait ;
30
+ #[ cfg( CONFIG_RUST_ALLOC ) ]
24
31
use crate :: work:: futures:: WakeInfo ;
25
32
use crate :: {
26
33
error:: { to_result_void, Result } ,
@@ -74,6 +81,7 @@ impl Semaphore {
74
81
/// Take a semaphore, async version.
75
82
///
76
83
/// Returns a future that either waits for the semaphore, or returns status.
84
+ #[ cfg( CONFIG_RUST_ALLOC ) ]
77
85
pub fn take_async < ' a > ( & ' a self , timeout : impl Into < Timeout > ) -> impl Future < Output = Result < ( ) > > + ' a {
78
86
SemTake {
79
87
sem : self ,
@@ -109,6 +117,7 @@ impl Semaphore {
109
117
}
110
118
111
119
/// The async 'take' Future
120
+ #[ cfg( CONFIG_RUST_ALLOC ) ]
112
121
struct SemTake < ' a > {
113
122
/// The semaphore we're waiting on.
114
123
sem : & ' a Semaphore ,
@@ -118,6 +127,7 @@ struct SemTake<'a> {
118
127
ran : bool ,
119
128
}
120
129
130
+ #[ cfg( CONFIG_RUST_ALLOC ) ]
121
131
impl < ' a > Future for SemTake < ' a > {
122
132
type Output = Result < ( ) > ;
123
133
0 commit comments