wip: staticify?

This commit is contained in:
Jonathan Kelley committed 2021-03-11 12:27:01 -05:00
1 parent 78d093a945
commit 5ad81885e4
21 files changed
+433 -346

No files matched your search

+7
View File
@@ -11,7 +11,9 @@ pub type ScopeIdx = generational_arena::Index;
pub trait Properties: PartialEq {
type Builder;
type StaticOutput: Properties + 'static;
fn builder() -> Self::Builder;
unsafe fn into_static(self) -> Self::StaticOutput;
}
pub struct EmptyBuilder;
@@ -23,10 +25,15 @@ impl EmptyBuilder {
impl Properties for () {
type Builder = EmptyBuilder;
type StaticOutput = ();
fn builder() -> Self::Builder {
EmptyBuilder {}
}
unsafe fn into_static(self) -> Self::StaticOutput {
std::mem::transmute(self)
}
}
pub fn fc_to_builder<T: Properties>(_f: FC<T>) -> T::Builder {