summaryrefslogtreecommitdiffstats
path: root/native/src/widget/action.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-08-05 05:15:41 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-08-05 05:15:41 +0200
commit66f7d43dc98df96c8b19cfd2aef6dcdd4187316c (patch)
treea252a9c81359d2f13401380538bd11c0ee6bbc37 /native/src/widget/action.rs
parent13dd1ca0a83cc95eea52e2106da9dc1ee1f37958 (diff)
downloadiced-66f7d43dc98df96c8b19cfd2aef6dcdd4187316c.tar.gz
iced-66f7d43dc98df96c8b19cfd2aef6dcdd4187316c.tar.bz2
iced-66f7d43dc98df96c8b19cfd2aef6dcdd4187316c.zip
Write missing documentation in `iced_native`
Diffstat (limited to 'native/src/widget/action.rs')
-rw-r--r--native/src/widget/action.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/native/src/widget/action.rs b/native/src/widget/action.rs
index 21032dbb..766e902b 100644
--- a/native/src/widget/action.rs
+++ b/native/src/widget/action.rs
@@ -3,13 +3,17 @@ use crate::widget::Id;
use iced_futures::MaybeSend;
+/// An operation to be performed on the widget tree.
+#[allow(missing_debug_implementations)]
pub struct Action<T>(Box<dyn Operation<T>>);
impl<T> Action<T> {
+ /// Creates a new [`Action`] with the given [`Operation`].
pub fn new(operation: impl Operation<T> + 'static) -> Self {
Self(Box::new(operation))
}
+ /// Maps the output of an [`Action`] using the given function.
pub fn map<A>(
self,
f: impl Fn(T) -> A + 'static + MaybeSend + Sync,
@@ -24,11 +28,13 @@ impl<T> Action<T> {
}))
}
+ /// Consumes the [`Action`] and returns the internal [`Operation`].
pub fn into_operation(self) -> Box<dyn Operation<T>> {
self.0
}
}
+#[allow(missing_debug_implementations)]
struct Map<A, B> {
operation: Box<dyn Operation<A>>,
f: Box<dyn Fn(A) -> B>,