mahf 0.1.0

A framework for modular construction and evaluation of metaheuristics.
Documentation
//! Marker trait for custom state.

/// Marker trait to represent a custom state that is `Send + 'a`.
///
/// This trait is **not** automatically implemented for arbitrary types.
///
/// Custom state is stored in the [`StateRegistry`] and can be accessed according to
/// the typical borrowing model (one writer xor multiple readers).
///
/// [`StateRegistry`]: crate::state::StateRegistry
///
/// # Requires
///
/// Requires to implement [`better_any::Tid`], which can be done using the `Tid` derive macro.
///
/// # Examples
///
/// Custom state wrapping a owned type:
/// ```
/// use better_any::{Tid, TidAble};
/// use mahf::CustomState;
///
/// #[derive(Tid)]
/// pub struct Owned(usize);
/// impl CustomState<'_> for Owned {}
/// ```
///
/// Custom state wrapping a reference with a lifetime:
/// ```
/// use better_any::{Tid, TidAble};
/// use mahf::CustomState;
///
/// #[derive(Tid)]
/// pub struct Reference<'a>(&'a mut usize);
/// impl<'a> CustomState<'a> for Reference<'a> {}
/// ```
pub trait CustomState<'a>: better_any::Tid<'a> + Send {}