feat: somewhat working with rc and weak

This commit is contained in:
Jonathan Kelley committed 2021-03-12 14:27:32 -05:00
1 parent ec801eab16
commit d4f1ceaffb
10 files changed
+170 -137

No files matched your search

-5
View File
@@ -71,14 +71,9 @@ 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
View File
@@ -27,12 +27,7 @@ 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
}
}
+3 -3
View File
@@ -12,12 +12,12 @@ static Header: FC<()> = |ctx, props| {
let handler1 = move || println!("Value is {}", inner.current());
ctx.render(|bump| {
builder::ElementBuilder::new(bump, "div")
ctx.render(|c| {
builder::ElementBuilder::new(c, "div")
.child(VNode::Component(VComponent::new(
Bottom,
//
&mut (),
c.bump.alloc(()),
)))
.finish()
})
-5
View File
@@ -27,12 +27,7 @@ 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
}
}