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,7 +1,5 @@
//! Load and use fonts.
pub use iced_core::font::*;
use crate::command::{self, Command};
use crate::{Action, Task};
use std::borrow::Cow;
/// An error while loading a font.
@ -9,11 +7,9 @@ use std::borrow::Cow;
pub enum Error {}
/// Load a font from its bytes.
pub fn load(
bytes: impl Into<Cow<'static, [u8]>>,
) -> Command<Result<(), Error>> {
Command::single(command::Action::LoadFont {
pub fn load(bytes: impl Into<Cow<'static, [u8]>>) -> Task<Result<(), Error>> {
Task::oneshot(|channel| Action::LoadFont {
bytes: bytes.into(),
tagger: Box::new(std::convert::identity),
channel,
})
}