summaryrefslogtreecommitdiffstats
path: root/native/src/program.rs
diff options
context:
space:
mode:
Diffstat (limited to 'native/src/program.rs')
-rw-r--r--native/src/program.rs22
1 files changed, 10 insertions, 12 deletions
diff --git a/native/src/program.rs b/native/src/program.rs
index 14afcd84..75fab094 100644
--- a/native/src/program.rs
+++ b/native/src/program.rs
@@ -1,5 +1,5 @@
//! Build interactive programs using The Elm Architecture.
-use crate::{Command, Element, Renderer};
+use crate::{Clipboard, Command, Element, Renderer};
mod state;
@@ -8,14 +8,13 @@ pub use state::State;
/// The core of a user interface application following The Elm Architecture.
pub trait Program: Sized {
/// The graphics backend to use to draw the [`Program`].
- ///
- /// [`Program`]: trait.Program.html
type Renderer: Renderer;
/// The type of __messages__ your [`Program`] will produce.
- ///
- /// [`Program`]: trait.Program.html
- type Message: std::fmt::Debug + Send;
+ type Message: std::fmt::Debug + Clone + Send;
+
+ /// The type of [`Clipboard`] your [`Program`] will use.
+ type Clipboard: Clipboard;
/// Handles a __message__ and updates the state of the [`Program`].
///
@@ -25,15 +24,14 @@ pub trait Program: Sized {
///
/// Any [`Command`] returned will be executed immediately in the
/// background by shells.
- ///
- /// [`Program`]: trait.Application.html
- /// [`Command`]: struct.Command.html
- fn update(&mut self, message: Self::Message) -> Command<Self::Message>;
+ fn update(
+ &mut self,
+ message: Self::Message,
+ clipboard: &mut Self::Clipboard,
+ ) -> Command<Self::Message>;
/// Returns the widgets to display in the [`Program`].
///
/// These widgets can produce __messages__ based on user interaction.
- ///
- /// [`Program`]: trait.Program.html
fn view(&mut self) -> Element<'_, Self::Message, Self::Renderer>;
}