Add doc to direct developers to enable features for iced::time::every#2188
Conversation
|
This comment provides a more detailed explanation of the PR. The online document has a function named iced::time::every. As outlined in the document, there are no constraints on using this function, particularly requiring any specific features. However, when calling the function as shown below: struct MyApp;
impl iced::Application for MyApp {
type Executor = iced::executor::Default;
type Message = iced::time::Instant;
type Theme = iced::Theme;
type Flags = ();
fn new(_flags: Self::Flags) -> (Self, iced::Command<Self::Message>) {
(Self, iced::Command::none())
}
fn title(&self) -> String {
"".into()
}
fn update(&mut self, _message: Self::Message) -> iced::Command<Self::Message> {
iced::Command::none()
}
fn view(&self) -> iced::Element<'_, Self::Message, iced::Renderer<Self::Theme>> {
"".into()
}
fn subscription(&self) -> iced::Subscription<Self::Message> {
iced::time::every(std::time::Duration::from_secs(1))
}
}and including the following dependencies in the [dependencies]
iced = "0.10.0"it leads to a compiler error: To address this issue, the simplest solution is to enable one of the following features: tokio, async-std, or smol. This PR includes documentation for the function, explicitly instructing developers to enable the mentioned features. While this may potentially be a (If you believe the problem is not significant, please inform me, and I will close the PR.) |
hecrj
left a comment
There was a problem hiding this comment.
Thanks! I made some changes to use doc_cfg instead.
Online document of Iced has the function iced::time::every. However, this function cannot be called when using thread-pool backend.
This PR adds doc to explicitly direct developers to enable appropriate features. This does not change any compiled code.