minfac/
strategy.rs

1use core::{
2    any::{Any, TypeId},
3    fmt::Debug,
4};
5
6#[cfg_attr(feature = "stable_abi", abi_stable::sabi_trait)]
7pub trait Strategy: Debug + Send + Sync {
8    type Id: Ord + Debug + Copy + PartialEq + Eq;
9}
10
11pub trait Identifyable<T: Ord>: 'static {
12    fn get_id() -> T;
13}
14
15impl<T: Any> Identifyable<TypeId> for T {
16    fn get_id() -> TypeId {
17        TypeId::of::<T>()
18    }
19}
20
21#[derive(PartialEq, Debug)]
22pub struct AnyStrategy;
23impl Strategy for AnyStrategy {
24    type Id = TypeId;
25}