#![allow(unused_parens)] use sycamore::prelude::{component, view, Props, Signal, View}; #[component(inline_props)] fn NoProps() -> View { view! {} } #[component(inline_props)] fn SimpleComponent(my_number: u32) -> View { view! { (my_number) } } #[component(inline_props)] fn MultiProps(my_number: u32, my_string: String) -> View { view! { (my_number) (my_string) } } #[component(inline_props)] fn PropsWithGenericLifetime(data: Signal) -> View { view! { (data.get()) } } #[component(inline_props)] fn UnusedGeneric() -> View { view! {} } #[component(inline_props)] fn PropsWithGenericTypes(foo: T) -> View { view! { (foo.to_string()) } } #[component(inline_props)] fn PropsWithImplGenerics(foo: impl std::fmt::Display + 'static) -> View { view! { (foo.to_string()) } } #[component(inline_props)] fn PropsWithMixedImplGenerics( foo: T, bar: impl std::fmt::Display + 'static, ) -> View { view! { (foo.to_string()) (bar.to_string()) } } #[component(inline_props)] fn PropsWithVariousImplGenerics( t1: [impl std::fmt::Display + 'static; 10], t2: ( impl std::fmt::Display + 'static, impl std::fmt::Display + 'static, ), t3: (impl std::fmt::Display + 'static), t4: impl std::fmt::Display + 'static, t5: *const (impl std::fmt::Display + 'static), t6: &'static (impl std::fmt::Display + 'static), t7: &'static [impl std::fmt::Display + 'static], ) -> View { let _ = t1; let _ = t2; let _ = t3; let _ = t5; let _ = t6; let _ = t7; view! { (t4.to_string()) } } #[component(inline_props, derive(Clone), derive(Debug))] fn AdditionalStructAttributes(dummy: String) -> View { let props = AdditionalStructAttributes_Props::builder() .dummy(dummy) .build(); view! { (format!("{:?}", props.clone())) } } #[component(inline_props)] fn PropsWithAttributes(#[prop(default)] dummy: String) -> View { fn call_component() -> View { view! { PropsWithAttributes {} } } view! { (dummy) } } #[derive(Debug)] struct Foo { bar: u32, } #[component(inline_props)] fn PropsWithPatterns(mut a: u32, b @ Foo { bar }: Foo) -> View { let _ = &mut a; view! { (a) (format!("{b:?}")) (bar) } } fn main() {}