maplibre/tcs/
mod.rs

1use std::{any::TypeId, collections::HashSet};
2
3pub mod resources;
4pub mod system;
5pub mod tiles;
6pub mod world;
7
8#[derive(Default)]
9pub struct GlobalQueryState {
10    mutably_borrowed: HashSet<TypeId>,
11}
12
13pub trait QueryState<'s> {
14    fn create(state: &'s mut GlobalQueryState) -> Self;
15    fn clone_to<'a, S: QueryState<'a>>(&'a mut self) -> S;
16}
17
18pub struct EphemeralQueryState<'s> {
19    state: &'s mut GlobalQueryState,
20}
21
22impl<'s> QueryState<'s> for EphemeralQueryState<'s> {
23    fn create(state: &'s mut GlobalQueryState) -> Self {
24        Self { state }
25    }
26
27    fn clone_to<'a, S: QueryState<'a>>(&'a mut self) -> S {
28        S::create(self.state)
29    }
30}