a3s_orm/schema.rs
1use std::marker::PhantomData;
2
3pub trait Table: Send + Sync + 'static {
4 const NAME: &'static str;
5}
6
7#[derive(Debug, Clone, Copy)]
8pub struct TableRef<T: Table> {
9 marker: PhantomData<T>,
10}
11
12impl<T: Table> Default for TableRef<T> {
13 fn default() -> Self {
14 Self::new()
15 }
16}
17
18impl<T: Table> TableRef<T> {
19 pub const fn new() -> Self {
20 Self {
21 marker: PhantomData,
22 }
23 }
24
25 pub const fn name(&self) -> &'static str {
26 T::NAME
27 }
28}