poc.rs 510 B

123456789101112131415161718192021222324252627282930
  1. //! POC: Planning the layout of a single element type
  2. //!
  3. //!
  4. //! The ultimate goal with a dedicated namespace is three-fold:
  5. //! - compile-time correct templates preventing misuse of elemnents
  6. //! - deep integration of DSL with IDE
  7. //!
  8. //!
  9. //!
  10. struct NodeFactory {}
  11. struct div<'a>(&NodeFactory);
  12. impl<'a> div<'a> {
  13. fn new(cx: &NodeFactory) -> Self {
  14. div(cx)
  15. }
  16. }
  17. fn main() {}
  18. fn factory(
  19. // this is your mom
  20. cx: &NodeFactory,
  21. ) {
  22. div::new(cx);
  23. rsx! {
  24. div {}
  25. }
  26. }