-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76ad9ca
commit e7f0075
Showing
5 changed files
with
88 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use crate::column::IntoColumn; | ||
use crate::Value; | ||
|
||
pub trait WorkTableField { | ||
#[allow(private_bounds)] | ||
type Type: IntoColumn + Into<Value>; | ||
const INDEX: usize; | ||
const NAME: &'static str; | ||
const PRIMARY: bool = false; | ||
} | ||
#[macro_export] | ||
macro_rules! field { | ||
( | ||
$index: expr, $f: ident: $ty: ty, $name: expr $(, primary = $indexed: expr)? | ||
) => { | ||
pub struct $f; | ||
impl $crate::WorkTableField for $f { | ||
type Type = $ty; | ||
const INDEX: usize = $index; | ||
const NAME: &'static str = $name; | ||
$(const PRIMARY: bool = $indexed;)? // optional | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
///! worktable | ||
mod column; | ||
mod field; | ||
mod row; | ||
mod ty; | ||
mod value; | ||
mod worktable; | ||
pub use column::*; | ||
pub use field::*; | ||
pub use row::*; | ||
pub use value::*; | ||
pub use worktable::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters