diff options
author | 2024-06-14 01:47:39 +0200 | |
---|---|---|
committer | 2024-06-14 01:47:39 +0200 | |
commit | a25b1af45690bdd8e1cbb20ee3a5b1c4342de455 (patch) | |
tree | 432044cf682dd73d1019a2f964749e78db178865 /runtime/src/font.rs | |
parent | e6d0b3bda5042a1017a5944a5227c97e0ed6caf9 (diff) | |
download | iced-a25b1af45690bdd8e1cbb20ee3a5b1c4342de455.tar.gz iced-a25b1af45690bdd8e1cbb20ee3a5b1c4342de455.tar.bz2 iced-a25b1af45690bdd8e1cbb20ee3a5b1c4342de455.zip |
Replace `Command` with a new `Task` API with chain support
Diffstat (limited to 'runtime/src/font.rs')
-rw-r--r-- | runtime/src/font.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/runtime/src/font.rs b/runtime/src/font.rs index 15359694..d54eb6a8 100644 --- a/runtime/src/font.rs +++ b/runtime/src/font.rs @@ -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, }) } |