Draft time-travel debugging feature

This commit is contained in:
Héctor Ramón Jiménez 2025-04-17 03:24:17 +02:00
parent 388a419ed5
commit d5d4479a53
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
20 changed files with 330 additions and 63 deletions

View file

@ -10,9 +10,12 @@ categories.workspace = true
keywords.workspace = true
rust-version.workspace = true
[lints]
workspace = true
[features]
time-travel = []
[dependencies]
iced_graphics.workspace = true
iced_runtime.workspace = true
[lints]
workspace = true

View file

@ -22,7 +22,7 @@ pub trait Program: Sized {
type State;
/// The message of the program.
type Message: Send + std::fmt::Debug + 'static;
type Message: Message + 'static;
/// The theme of the program.
type Theme: Default + theme::Base;
@ -642,3 +642,17 @@ impl<P: Program> Instance<P> {
self.program.scale_factor(&self.state, window)
}
}
/// A trait alias for the [`Message`](Program::Message) of a [`Program`].
#[cfg(feature = "time-travel")]
pub trait Message: Send + std::fmt::Debug + Clone {}
#[cfg(feature = "time-travel")]
impl<T: Send + std::fmt::Debug + Clone> Message for T {}
/// A trait alias for the [`Message`](Program::Message) of a [`Program`].
#[cfg(not(feature = "time-travel"))]
pub trait Message: Send + std::fmt::Debug {}
#[cfg(not(feature = "time-travel"))]
impl<T: Send + std::fmt::Debug> Message for T {}