rust_toolkit_effects/
lib.rs1#![forbid(unsafe_code)]
7
8mod sealed {
9 pub trait EffectSealed {}
10
11 impl<T> EffectSealed for T where
12 T: ?Sized + crate::__private::EffectDefinition + Send + Sync + 'static
13 {
14 }
15}
16
17pub trait Effect: sealed::EffectSealed + Send + Sync + 'static {}
22
23impl<T> Effect for T where
24 T: ?Sized + crate::__private::EffectDefinition + Send + Sync + 'static
25{
26}
27
28pub trait EffectHandler<E>: Send + Sync + 'static
30where
31 E: ?Sized + Effect,
32 Self: crate::__private::HandlerDefinition<E>,
33{
34}
35
36impl<T, E> EffectHandler<E> for T
37where
38 T: ?Sized + Send + Sync + 'static,
39 E: ?Sized + Effect,
40 T: crate::__private::HandlerDefinition<E>,
41{
42}
43
44#[doc(hidden)]
46pub mod __private {
47 use core::marker::PhantomData;
48
49 pub trait EffectDefinition {}
50
51 pub trait HandlerDefinition<E: ?Sized> {}
52
53 pub struct HandlerToken<T: ?Sized, E: ?Sized>(
56 pub PhantomData<fn() -> (*const T, *const E)>,
57 );
58}