1use std::marker::PhantomData;
2
3pub trait Table {
4 const NAME: &'static str;
5
6 type Fields: Default;
7
8 fn table() -> TableQuery<Self> {
9 TableQuery { table: PhantomData }
10 }
11}
12
13pub trait TableQueryable {
14 type Table: Table + ?Sized;
15}
16
17pub struct TableQuery<T: ?Sized> {
18 table: PhantomData<T>,
19}
20
21impl<T: Table + ?Sized> TableQueryable for TableQuery<T> {
22 type Table = T;
23}
24
25impl<T: ?Sized> Clone for TableQuery<T> {
26 fn clone(&self) -> Self {
27 *self
28 }
29}
30
31impl<T: ?Sized> Copy for TableQuery<T> {}