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 } ,
@@ -77,6 +84,7 @@ impl Semaphore {
77
84
/// Take a semaphore, async version.
78
85
///
79
86
/// Returns a future that either waits for the semaphore, or returns status.
87
+ #[ cfg( CONFIG_RUST_ALLOC ) ]
80
88
pub fn take_async < ' a > ( & ' a self , timeout : impl Into < Timeout > ) -> impl Future < Output = Result < ( ) > > + ' a {
81
89
SemTake {
82
90
sem : self ,
@@ -118,6 +126,7 @@ impl Semaphore {
118
126
}
119
127
120
128
/// The async 'take' Future
129
+ #[ cfg( CONFIG_RUST_ALLOC ) ]
121
130
struct SemTake < ' a > {
122
131
/// The semaphore we're waiting on.
123
132
sem : & ' a Semaphore ,
@@ -127,6 +136,7 @@ struct SemTake<'a> {
127
136
ran : bool ,
128
137
}
129
138
139
+ #[ cfg( CONFIG_RUST_ALLOC ) ]
130
140
impl < ' a > Future for SemTake < ' a > {
131
141
type Output = Result < ( ) > ;
132
142
0 commit comments