Add new System variant to Action

This commit is contained in:
Richard 2022-02-16 19:20:26 -03:00
parent 6e93713197
commit fed8da1c90
5 changed files with 14 additions and 0 deletions

View file

@ -1,4 +1,5 @@
use crate::clipboard; use crate::clipboard;
use crate::system;
use crate::window; use crate::window;
use iced_futures::MaybeSend; use iced_futures::MaybeSend;
@ -17,6 +18,9 @@ pub enum Action<T> {
/// Run a window action. /// Run a window action.
Window(window::Action), Window(window::Action),
/// Run a system action.
System(system::Action),
} }
impl<T> Action<T> { impl<T> Action<T> {
@ -34,6 +38,7 @@ impl<T> Action<T> {
Self::Future(future) => Action::Future(Box::pin(future.map(f))), Self::Future(future) => Action::Future(Box::pin(future.map(f))),
Self::Clipboard(action) => Action::Clipboard(action.map(f)), Self::Clipboard(action) => Action::Clipboard(action.map(f)),
Self::Window(window) => Action::Window(window), Self::Window(window) => Action::Window(window),
Self::System(system) => Action::System(system),
} }
} }
} }
@ -46,6 +51,7 @@ impl<T> fmt::Debug for Action<T> {
write!(f, "Action::Clipboard({:?})", action) write!(f, "Action::Clipboard({:?})", action)
} }
Self::Window(action) => write!(f, "Action::Window({:?})", action), Self::Window(action) => write!(f, "Action::Window({:?})", action),
Self::System(action) => write!(f, "Action::System({:?})", action),
} }
} }
} }

View file

@ -48,6 +48,7 @@ pub mod program;
pub mod renderer; pub mod renderer;
pub mod subscription; pub mod subscription;
pub mod svg; pub mod svg;
pub mod system;
pub mod text; pub mod text;
pub mod touch; pub mod touch;
pub mod user_interface; pub mod user_interface;

3
native/src/system.rs Normal file
View file

@ -0,0 +1,3 @@
//! Access the native system.
mod action;
pub use action::Action;

View file

@ -0,0 +1,3 @@
/// An operation to be performed on the system.
#[derive(Debug)]
pub enum Action {}

View file

@ -573,6 +573,7 @@ pub fn run_command<Message: 'static + std::fmt::Debug + Send, E: Executor>(
}); });
} }
}, },
command::Action::System(_action) => {}
} }
} }
} }