refactored window storage;

new helper window events (Destroyed, Created);
clippy + fmt;
This commit is contained in:
Bingus 2023-07-12 19:21:05 -07:00
parent 633f405f3f
commit d53ccc857d
No known key found for this signature in database
GPG key ID: 5F84D2AA40A9F170
56 changed files with 1508 additions and 1819 deletions

View file

@ -0,0 +1,32 @@
//! Build interactive programs using The Elm Architecture.
use crate::{window, Command};
use crate::core::text;
use crate::core::{Element, Renderer};
/// The core of a user interface for a multi-window application following The Elm Architecture.
pub trait Program: Sized {
/// The graphics backend to use to draw the [`Program`].
type Renderer: Renderer + text::Renderer;
/// The type of __messages__ your [`Program`] will produce.
type Message: std::fmt::Debug + Send;
/// Handles a __message__ and updates the state of the [`Program`].
///
/// This is where you define your __update logic__. All the __messages__,
/// produced by either user interactions or commands, will be handled by
/// this method.
///
/// Any [`Command`] returned will be executed immediately in the
/// background by shells.
fn update(&mut self, message: Self::Message) -> Command<Self::Message>;
/// Returns the widgets to display in the [`Program`] for the `window`.
///
/// These widgets can produce __messages__ based on user interaction.
fn view(
&self,
window: window::Id,
) -> Element<'_, Self::Message, Self::Renderer>;
}