implement Debug for Task
This commit is contained in:
parent
7c5a4bc465
commit
15230cbee3
1 changed files with 11 additions and 1 deletions
|
|
@ -17,7 +17,6 @@ pub use sipper::{Never, Sender, Sipper, Straw, sipper, stream};
|
||||||
/// A set of concurrent actions to be performed by the iced runtime.
|
/// A set of concurrent actions to be performed by the iced runtime.
|
||||||
///
|
///
|
||||||
/// A [`Task`] _may_ produce a bunch of values of type `T`.
|
/// A [`Task`] _may_ produce a bunch of values of type `T`.
|
||||||
#[allow(missing_debug_implementations)]
|
|
||||||
#[must_use = "`Task` must be returned to the runtime to take effect; normally in your `update` or `new` functions."]
|
#[must_use = "`Task` must be returned to the runtime to take effect; normally in your `update` or `new` functions."]
|
||||||
pub struct Task<T> {
|
pub struct Task<T> {
|
||||||
stream: Option<BoxStream<Action<T>>>,
|
stream: Option<BoxStream<Action<T>>>,
|
||||||
|
|
@ -278,6 +277,17 @@ impl<T> Task<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: std::fmt::Debug> std::fmt::Debug for Task<T> {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"Task<{}>, units={}",
|
||||||
|
std::any::type_name::<T>(),
|
||||||
|
self.units
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A handle to a [`Task`] that can be used for aborting it.
|
/// A handle to a [`Task`] that can be used for aborting it.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Handle {
|
pub struct Handle {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue