Replace Command with a new Task API with chain support

This commit is contained in:
Héctor Ramón Jiménez 2024-06-14 01:47:39 +02:00
parent e6d0b3bda5
commit a25b1af456
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
74 changed files with 1351 additions and 1767 deletions

View file

@ -1,15 +1,13 @@
//! Access the native system.
use crate::graphics::compositor;
use crate::runtime::command::{self, Command};
use crate::runtime::system::{Action, Information};
use crate::runtime::{self, Task};
/// Query for available system information.
pub fn fetch_information<Message>(
f: impl Fn(Information) -> Message + Send + 'static,
) -> Command<Message> {
Command::single(command::Action::System(Action::QueryInformation(
Box::new(f),
)))
pub fn fetch_information() -> Task<Information> {
Task::oneshot(|channel| {
runtime::Action::System(Action::QueryInformation(channel))
})
}
pub(crate) fn information(