Introduce Program API
This commit is contained in:
parent
0524e9b457
commit
c22269bff3
43 changed files with 1141 additions and 831 deletions
|
|
@ -1,12 +1,12 @@
|
|||
use iced::widget::{button, column, container, text};
|
||||
use iced::{
|
||||
executor, system, Application, Command, Element, Length, Settings, Theme,
|
||||
};
|
||||
use iced::{system, Command, Element, Length};
|
||||
|
||||
use bytesize::ByteSize;
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
Example::run(Settings::default())
|
||||
iced::application(Example::new, Example::update, Example::view)
|
||||
.title("System Information - Iced")
|
||||
.run()
|
||||
}
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
|
|
@ -22,23 +22,14 @@ enum Message {
|
|||
Refresh,
|
||||
}
|
||||
|
||||
impl Application for Example {
|
||||
type Message = Message;
|
||||
type Theme = Theme;
|
||||
type Executor = executor::Default;
|
||||
type Flags = ();
|
||||
|
||||
fn new(_flags: ()) -> (Self, Command<Message>) {
|
||||
impl Example {
|
||||
fn new() -> (Self, Command<Message>) {
|
||||
(
|
||||
Self::Loading,
|
||||
system::fetch_information(Message::InformationReceived),
|
||||
)
|
||||
}
|
||||
|
||||
fn title(&self) -> String {
|
||||
String::from("System Information - Iced")
|
||||
}
|
||||
|
||||
fn update(&mut self, message: Message) -> Command<Message> {
|
||||
match message {
|
||||
Message::Refresh => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue