Introduce Refinement trait and derive macro
This commit is contained in:
parent
19ccb19c96
commit
9b74dc196e
22 changed files with 6164 additions and 244 deletions
13
crates/refineable/src/refineable.rs
Normal file
13
crates/refineable/src/refineable.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
pub use derive_refineable::Refineable;
|
||||
|
||||
pub trait Refineable {
|
||||
type Refinement;
|
||||
|
||||
fn refine(&self, refinement: &Self::Refinement) -> Self;
|
||||
fn from_refinement(refinement: &Self::Refinement) -> Self
|
||||
where
|
||||
Self: Sized + Default,
|
||||
{
|
||||
Self::default().refine(refinement)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue