We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Message
system_information
1 parent 334f5ba commit 1e5c1adCopy full SHA for 1e5c1ad
1 file changed
examples/system_information/src/main.rs
@@ -29,23 +29,27 @@ enum Message {
29
30
impl Example {
31
fn new() -> (Self, Task<Message>) {
32
- (Self::Loading, Task::done(Message::Refresh))
+ (
33
+ Self::Loading,
34
+ system::fetch_information().map(Message::InformationReceived),
35
+ )
36
}
-
37
+
38
fn update(&mut self, message: Message) -> Task<Message> {
39
match message {
40
Message::Refresh => {
- *self = Self::Loading;
41
+ let (state, refresh) = Self::new();
42
43
+ *self = state;
44
- return system::fetch_information()
- .map(Message::InformationReceived);
45
+ refresh
46
47
Message::InformationReceived(information) => {
48
*self = Self::Loaded { information };
49
50
+ Task::none()
51
52
- Task::none()
53
54
55
fn view(&self) -> Element<Message> {
0 commit comments