2024-05-02 23:47:47 +02:00
|
|
|
use std::{ops::Deref, sync::Arc};
|
|
|
|
|
2024-05-11 23:23:00 +02:00
|
|
|
use crate::core_state::State;
|
2024-05-02 23:47:47 +02:00
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct SharedState {
|
|
|
|
state: Arc<State>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Deref for SharedState {
|
|
|
|
type Target = State;
|
|
|
|
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
&self.state
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<State> for SharedState {
|
|
|
|
fn from(value: State) -> Self {
|
|
|
|
Self {
|
|
|
|
state: Arc::new(value),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|