rsxt.rs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. pub mod dioxus {
  2. pub mod builder {
  3. pub struct Builder;
  4. struct AttrVal;
  5. impl Into<AttrVal> for &'static str {
  6. fn into(self) -> AttrVal {
  7. todo!()
  8. }
  9. }
  10. impl Into<AttrVal> for String {
  11. fn into(self) -> AttrVal {
  12. todo!()
  13. }
  14. }
  15. // impl<T> From<T> for AttrVal {
  16. // fn from(_: T) -> Self {
  17. // todo!()
  18. // }
  19. // }
  20. impl Builder {
  21. // fn attr<T>(mut self, key: &str, value: impl Into<AttrVal>) -> Self {
  22. pub fn attr<T>(self, _key: &str, _value: T) -> Self {
  23. Self
  24. }
  25. pub fn on<T>(self, _key: &str, _value: T) -> Self {
  26. Self
  27. }
  28. pub fn finish(self) {
  29. // Self
  30. }
  31. }
  32. pub struct Bump;
  33. pub fn div(_bump: &Bump) -> Builder {
  34. todo!()
  35. }
  36. pub fn h1(_bump: &Bump) -> Builder {
  37. todo!()
  38. }
  39. pub fn h2(_bump: &Bump) -> Builder {
  40. todo!()
  41. }
  42. }
  43. }
  44. pub fn main() {
  45. // render(rsx! {
  46. // div { // we can actually support just a list of nodes too
  47. // h1 {"Hello Dioxus"}
  48. // p {"This is a beautful app you're building"}
  49. // section {
  50. // "custom section to the rescue",
  51. // class: "abc123"
  52. // }
  53. // span {
  54. // class: "abc123"
  55. // "Try backwards too."
  56. // "Anything goes!"
  57. // "As long as it's within the rules"
  58. // {0..10.map(|f| rsx!{
  59. // div {
  60. // h3 {"totally okay to drop in iterators and expressions"}
  61. // p {"however, debug information is lost"}
  62. // }
  63. // })}
  64. // }
  65. // span {
  66. // "Feel free"
  67. // class: "abc123"
  68. // "To mix to your heart's content"
  69. // }
  70. // span { class: "some-very-long-and-tedious-class-name-is-now-separated"
  71. // "Very ergonomic"
  72. // }
  73. // span { "Innovative design 🛠"
  74. // class: "some-very-long-and-tedious-class-name-is-now-separated"
  75. // }
  76. // }
  77. // });
  78. let _g = String::from("asd");
  79. // let lazy = rsx! {
  80. // div {
  81. // a: "asd",
  82. // a: "asd",
  83. // a: "asd",
  84. // a: "asd",
  85. // a: "asd",
  86. // // a: {rsx!{ h1 {"hello world"} }}, // include
  87. // a: {&g},
  88. // b: {1 + 2},
  89. // onclick: {move |e: ()| {
  90. // println!("hello world!")
  91. // }},
  92. // div {
  93. // a: "asd"
  94. // div {
  95. // div {
  96. // div {
  97. // }
  98. // }
  99. // }
  100. // }
  101. // h1 {
  102. // }
  103. // h2 {
  104. // "child"
  105. // }
  106. // "Childnode"
  107. // }
  108. // };
  109. // render(lazy);
  110. }
  111. fn render(_f: impl Fn(&dioxus::builder::Bump)) {}