textiler_core/context/
mode_context.rs

1use crate::theme::theme_mode::ThemeMode;
2use std::ops::{Deref, DerefMut};
3use yew::UseStateHandle;
4
5#[derive(Debug, Clone, PartialEq)]
6pub struct ThemeModeContext {
7    ctx: UseStateHandle<ThemeMode>,
8}
9
10impl ThemeModeContext {
11    pub fn new(ctx: UseStateHandle<ThemeMode>) -> Self {
12        Self { ctx }
13    }
14}
15
16impl Deref for ThemeModeContext {
17    type Target = UseStateHandle<ThemeMode>;
18
19    fn deref(&self) -> &Self::Target {
20        &self.ctx
21    }
22}
23
24impl DerefMut for ThemeModeContext {
25    fn deref_mut(&mut self) -> &mut Self::Target {
26        &mut self.ctx
27    }
28}