Skip to main content

rstm_state/traits/
convert.rs

1/*
2    Appellation: convert <module>
3    Created At: 2026.01.11:12:43:19
4    Contrib: @FL03
5*/
6use crate::state::State;
7use crate::traits::RawState;
8
9/// [`IntoState`] defines a conversion consuming the caller and transforming into a [`State`]
10/// of type `Q`.
11pub trait IntoState<Q> {
12    private! {}
13
14    fn into_state(self) -> State<Q>;
15}
16/*
17 ************* Implementations *************
18*/
19
20impl<U, Q> IntoState<Q> for U
21where
22    Q: RawState,
23    U: Into<State<Q>>,
24{
25    seal! {}
26
27    fn into_state(self) -> State<Q> {
28        self.into()
29    }
30}