Skip to content

Commit b385c4b

Browse files
committed
Remove channel_impl from futures-sink
Add an optional `sink` feature to futures-channel that implements `Sink` for the mpsc channel.
1 parent 08dfdc6 commit b385c4b

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

futures-channel/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ name = "futures_channel"
1616

1717
[features]
1818
std = ["futures-core-preview/std"]
19+
sink = ["futures-sink-preview"]
1920
default = ["std"]
2021

2122
[dependencies]
2223
futures-core-preview = { path = "../futures-core", version = "=0.3.0-alpha.16", default-features = false }
24+
futures-sink-preview = { path = "../futures-sink", version = "=0.3.0-alpha.16", default-features = false, optional = true }
2325

2426
[dev-dependencies]
2527
futures-preview = { path = "../futures", version = "=0.3.0-alpha.16", default-features = true }

futures-channel/src/mpsc/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ use std::sync::atomic::Ordering::SeqCst;
9292
use crate::mpsc::queue::Queue;
9393

9494
mod queue;
95+
#[cfg(feature = "sink")]
96+
mod sink_impl;
9597

9698
#[derive(Debug)]
9799
struct SenderInner<T> {

futures-sink/src/channel_impls.rs renamed to futures-channel/src/mpsc/sink_impl.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use crate::{Poll, Sink};
2-
use futures_channel::mpsc::{SendError, Sender, TrySendError, UnboundedSender};
3-
use futures_core::task::Context;
1+
use super::{SendError, Sender, TrySendError, UnboundedSender};
2+
use futures_core::task::{Context, Poll};
3+
use futures_sink::Sink;
44
use std::pin::Pin;
55

66
impl<T> Sink<T> for Sender<T> {

futures-sink/Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ The asynchronous `Sink` trait for the futures-rs library.
1515
name = "futures_sink"
1616

1717
[features]
18-
std = ["alloc", "futures-core-preview/std", "futures-channel-preview/std"]
18+
std = ["alloc", "futures-core-preview/std"]
1919
default = ["std"]
2020
nightly = ["futures-core-preview/nightly"]
2121
alloc = ["futures-core-preview/alloc"]
2222

2323
[dependencies]
2424
futures-core-preview = { path = "../futures-core", version = "=0.3.0-alpha.16", default-features = false }
25-
futures-channel-preview = { path = "../futures-channel", version = "=0.3.0-alpha.16", default-features = false }

futures-sink/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ where
159159
}
160160
}
161161

162-
#[cfg(feature = "std")]
163-
mod channel_impls;
164-
165162
#[cfg(feature = "alloc")]
166163
mod if_alloc {
167164
use super::*;

futures/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ appveyor = { repository = "rust-lang-nursery/futures-rs" }
2424

2525
[dependencies]
2626
futures-core-preview = { path = "../futures-core", version = "=0.3.0-alpha.16", default-features = false }
27-
futures-channel-preview = { path = "../futures-channel", version = "=0.3.0-alpha.16", default-features = false }
27+
futures-channel-preview = { path = "../futures-channel", version = "=0.3.0-alpha.16", default-features = false, features = ["sink"] }
2828
futures-executor-preview = { path = "../futures-executor", version = "=0.3.0-alpha.16", default-features = false }
2929
futures-io-preview = { path = "../futures-io", version = "=0.3.0-alpha.16", default-features = false }
3030
futures-sink-preview = { path = "../futures-sink", version = "=0.3.0-alpha.16", default-features = false }

0 commit comments

Comments
 (0)