Skip to content

Commit 1da84e1

Browse files
committed
Make sipper dependency optional
1 parent 0fd54a1 commit 1da84e1

4 files changed

Lines changed: 11 additions & 2 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,14 @@ auto-detect-theme = ["iced_core/auto-detect-theme"]
6767
strict-assertions = ["iced_renderer/strict-assertions"]
6868
# Redraws on every runtime event, and not only when a widget requests it
6969
unconditional-rendering = ["iced_winit/unconditional-rendering"]
70+
# Enables support for the `sipper` library
71+
sipper = ["iced_runtime/sipper"]
7072

7173
[dependencies]
7274
iced_core.workspace = true
7375
iced_futures.workspace = true
7476
iced_renderer.workspace = true
77+
iced_runtime.workspace = true
7578
iced_widget.workspace = true
7679
iced_winit.features = ["program"]
7780
iced_winit.workspace = true

runtime/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@ iced_core.workspace = true
2323
iced_futures.workspace = true
2424

2525
raw-window-handle.workspace = true
26-
sipper.workspace = true
2726
thiserror.workspace = true
27+
28+
sipper.workspace = true
29+
sipper.optional = true

runtime/src/task.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ use crate::futures::futures::future::{self, FutureExt};
77
use crate::futures::futures::stream::{self, Stream, StreamExt};
88
use crate::futures::{BoxStream, MaybeSend, boxed_stream};
99

10+
use std::convert::Infallible;
1011
use std::sync::Arc;
1112

13+
#[cfg(feature = "sipper")]
1214
#[doc(no_inline)]
1315
pub use sipper::{Never, Sender, Sipper, Straw, sipper, stream};
1416

@@ -60,6 +62,7 @@ impl<T> Task<T> {
6062

6163
/// Creates a [`Task`] that runs the given [`Sipper`] to completion, mapping
6264
/// progress with the first closure and the output with the second one.
65+
#[cfg(feature = "sipper")]
6366
pub fn sip<S>(
6467
sipper: S,
6568
on_progress: impl FnMut(S::Progress) -> T + MaybeSend + 'static,
@@ -391,7 +394,7 @@ where
391394
}
392395

393396
/// Creates a new [`Task`] that executes the given [`Action`] and produces no output.
394-
pub fn effect<T>(action: impl Into<Action<Never>>) -> Task<T> {
397+
pub fn effect<T>(action: impl Into<Action<Infallible>>) -> Task<T> {
395398
let action = action.into();
396399

397400
Task(Some(boxed_stream(stream::once(async move {

0 commit comments

Comments
 (0)