Skip to content

Commit 10eaa88

Browse files
committed
Make features more independent
1 parent 8d432b3 commit 10eaa88

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,18 @@ pure = [
2929
"monadio",
3030
"cor",
3131
"actor",
32+
"handler",
33+
"publisher",
34+
"sync",
3235
]
3336
fp = [ ]
3437
maybe = [ ]
35-
monadio = [ ]
38+
sync = [ ]
3639
cor = [ ]
37-
actor = [ ]
40+
actor = [ "sync" ]
41+
handler = [ "sync" ]
42+
monadio = [ "sync", "handler" ]
43+
publisher = [ "sync", "handler" ]
3844

3945
# For test
4046
test_runtime = [ "pure", "for_futures" ]

src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ extern crate futures;
33
// #[cfg(feature = "for_futures")]
44
// extern crate tokio;
55

6+
pub mod common;
7+
8+
#[cfg(feature = "handler")]
69
pub mod handler;
10+
#[cfg(feature = "publisher")]
711
pub mod publisher;
12+
#[cfg(feature = "sync")]
813
pub mod sync;
914

10-
pub mod common;
11-
1215
#[cfg(feature = "actor")]
1316
pub mod actor;
1417
#[cfg(feature = "cor")]

src/sync.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ pub trait Will<T>: Send + Sync + 'static {
8686
fn result(&mut self) -> Option<T>;
8787
}
8888

89+
#[cfg(all(feature = "publisher", feature = "handler"))]
8990
#[derive(Clone)]
9091
pub struct WillAsync<T> {
9192
effect: Arc<Mutex<dyn FnMut() -> T + Send + Sync + 'static>>,
@@ -98,6 +99,7 @@ pub struct WillAsync<T> {
9899
waker: Arc<Mutex<Option<Waker>>>,
99100
}
100101

102+
#[cfg(all(feature = "publisher", feature = "handler"))]
101103
impl<T> WillAsync<T> {
102104
pub fn new(effect: impl FnMut() -> T + Send + Sync + 'static) -> WillAsync<T> {
103105
Self::new_with_handler(effect, HandlerThread::new_with_mutex())
@@ -119,6 +121,7 @@ impl<T> WillAsync<T> {
119121
}
120122
}
121123

124+
#[cfg(all(feature = "publisher", feature = "handler"))]
122125
impl<T> Will<T> for WillAsync<T>
123126
where
124127
T: Clone + Send + Sync + 'static,
@@ -206,7 +209,7 @@ where
206209
}
207210
}
208211

209-
#[cfg(feature = "for_futures")]
212+
#[cfg(all(feature = "for_futures", feature = "publisher", feature = "handler"))]
210213
impl<T> Future for WillAsync<T>
211214
where
212215
T: Clone + Send + Sync + 'static,

0 commit comments

Comments
 (0)