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

+5 -2
View File
@@ -7,8 +7,6 @@
fn main() {}
use dioxus_core::prelude::*;
struct Props {
@@ -73,9 +71,14 @@ impl PartialEq for ChildProps<'_> {
impl<'a> Properties for ChildProps<'a> {
type Builder = ChildPropsBuilder<'a, ((), ())>;
type StaticOutput = ChildProps<'static>;
fn builder() -> <Self as Properties>::Builder {
ChildProps::builder()
}
unsafe fn into_static(self) -> Self::StaticOutput {
unsafe { std::mem::transmute(self) }
}
}
fn ChildItem(_ctx: Context, _props: &ChildProps) -> DomTree {
+5 -3
View File
@@ -1,9 +1,6 @@
use dioxus_core::component::fc_to_builder;
use dioxus_core::prelude::*;
static BLAH: FC<()> = |ctx, _props| {
let g = "asd".to_string();
ctx.render(rsx! {
@@ -30,7 +27,12 @@ fn main() {}
impl Properties for ExampleProps {
type Builder = ExamplePropsBuilder<((),)>;
type StaticOutput = ExampleProps;
fn builder() -> Self::Builder {
ExampleProps::builder()
}
unsafe fn into_static(self) -> Self {
self
}
}
-4
View File
@@ -1,12 +1,8 @@
// #[macro_use]
extern crate fstrings;
// use dioxus_core::ifmt;
// use fstrings::format_args_f;
fn main() {
let bump = bumpalo::Bump::new();
let _b = &bump;
+5
View File
@@ -27,7 +27,12 @@ static Example: FC<SomeProps> = |ctx, _props| {
// toodo: derive this
impl Properties for SomeProps {
type Builder = SomePropsBuilder<((),)>;
type StaticOutput = SomeProps;
fn builder() -> Self::Builder {
SomeProps::builder()
}
unsafe fn into_static(self) -> Self {
self
}
}