summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-02-03 15:23:06 +0100
committerLibravatar GitHub <noreply@github.com>2024-02-03 15:23:06 +0100
commit1d58d44fad605e428e7c203f610d3f98e53970d7 (patch)
treef96d47005762bac799b1eafb3cdab3732d5095c8 /runtime
parent0b2c9db22868c43e4dd160b66abddce0846991b1 (diff)
parent4375e4b83c6572e23db9f2443bbc7fe266f7e0a8 (diff)
downloadiced-1d58d44fad605e428e7c203f610d3f98e53970d7.tar.gz
iced-1d58d44fad605e428e7c203f610d3f98e53970d7.tar.bz2
iced-1d58d44fad605e428e7c203f610d3f98e53970d7.zip
Merge pull request #2146 from Decodetalkers/customaction
feat: somewhere to place extra actions by platform
Diffstat (limited to '')
-rw-r--r--runtime/src/command/action.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/src/command/action.rs b/runtime/src/command/action.rs
index cb0936df..c9ffe801 100644
--- a/runtime/src/command/action.rs
+++ b/runtime/src/command/action.rs
@@ -1,11 +1,11 @@
use crate::clipboard;
use crate::core::widget;
use crate::font;
+use crate::futures::MaybeSend;
use crate::system;
use crate::window;
-use iced_futures::MaybeSend;
-
+use std::any::Any;
use std::borrow::Cow;
use std::fmt;
@@ -43,6 +43,9 @@ pub enum Action<T> {
/// The message to produce when the font has been loaded.
tagger: Box<dyn Fn(Result<(), font::Error>) -> T>,
},
+
+ /// A custom action supported by a specific runtime.
+ Custom(Box<dyn Any>),
}
impl<T> Action<T> {
@@ -72,6 +75,7 @@ impl<T> Action<T> {
bytes,
tagger: Box::new(move |result| f(tagger(result))),
},
+ Self::Custom(custom) => Action::Custom(custom),
}
}
}
@@ -90,6 +94,7 @@ impl<T> fmt::Debug for Action<T> {
Self::System(action) => write!(f, "Action::System({action:?})"),
Self::Widget(_action) => write!(f, "Action::Widget"),
Self::LoadFont { .. } => write!(f, "Action::LoadFont"),
+ Self::Custom(_) => write!(f, "Action::Custom"),
}
}
}