iced_program/
message.rs

1//! Traits for the message type of a [`Program`](crate::Program).
2
3/// A trait alias for [`Clone`], but only when the `time-travel`
4/// feature is enabled.
5#[cfg(feature = "time-travel")]
6pub trait MaybeClone: Clone {}
7
8#[cfg(feature = "time-travel")]
9impl<T> MaybeClone for T where T: Clone {}
10
11/// A trait alias for [`Clone`], but only when the `time-travel`
12/// feature is enabled.
13#[cfg(not(feature = "time-travel"))]
14pub trait MaybeClone {}
15
16#[cfg(not(feature = "time-travel"))]
17impl<T> MaybeClone for T {}
18
19/// A trait alias for [`Debug`](std::fmt::Debug), but only when the
20/// `debug` feature is enabled.
21#[cfg(feature = "debug")]
22pub trait MaybeDebug: std::fmt::Debug {}
23
24#[cfg(feature = "debug")]
25impl<T> MaybeDebug for T where T: std::fmt::Debug {}
26
27/// A trait alias for [`Debug`](std::fmt::Debug), but only when the
28/// `debug` feature is enabled.
29#[cfg(not(feature = "debug"))]
30pub trait MaybeDebug {}
31
32#[cfg(not(feature = "debug"))]
33impl<T> MaybeDebug for T {}