7a22303e
—
Peter John 3 years ago
v0.3.2
- Cargo.lock +1 -1
- Cargo.toml +2 -2
- impl/Cargo.lock +1 -1
- impl/Cargo.toml +1 -1
- impl/src/lib.rs +8 -0
- src/lib.rs +1 -1
- tests/lib.rs +8 -1
Cargo.lock
CHANGED
|
@@ -1465,7 +1465,7 @@ dependencies = [
|
|
|
1465
1465
|
|
|
1466
1466
|
[[package]]
|
|
1467
1467
|
name = "tide-jsx"
|
|
1468
|
-
version = "0.3.
|
|
1468
|
+
version = "0.3.1"
|
|
1469
1469
|
dependencies = [
|
|
1470
1470
|
"async-std",
|
|
1471
1471
|
"pretty_assertions",
|
Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "tide-jsx"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.2"
|
|
4
4
|
authors = ["pyrossh", "Gal Schlezinger <gal@spitfire.co.il>"]
|
|
5
5
|
edition = "2021"
|
|
6
6
|
description = "A safe and simple template engine with the ergonomics of JSX"
|
|
@@ -12,7 +12,7 @@ license = "MIT"
|
|
|
12
12
|
|
|
13
13
|
[dependencies]
|
|
14
14
|
tide = "0.16.0"
|
|
15
|
-
tide-jsx-impl = { path = "impl", version = "0.2.
|
|
15
|
+
tide-jsx-impl = { path = "impl", version = "0.2.1" }
|
|
16
16
|
|
|
17
17
|
[dev-dependencies]
|
|
18
18
|
pretty_assertions = "0.6"
|
impl/Cargo.lock
CHANGED
|
@@ -103,7 +103,7 @@ dependencies = [
|
|
|
103
103
|
|
|
104
104
|
[[package]]
|
|
105
105
|
name = "tide-jsx-impl"
|
|
106
|
-
version = "0.
|
|
106
|
+
version = "0.2.0"
|
|
107
107
|
dependencies = [
|
|
108
108
|
"pretty_assertions",
|
|
109
109
|
"proc-macro-error",
|
impl/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "tide-jsx-impl"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.1"
|
|
4
4
|
authors = ["pyrossh", "Gal Schlezinger <gal@spitfire.co.il>"]
|
|
5
5
|
edition = "2021"
|
|
6
6
|
description = "The macros needed for `render`"
|
impl/src/lib.rs
CHANGED
|
@@ -31,6 +31,14 @@ pub fn rsx(input: TokenStream) -> TokenStream {
|
|
|
31
31
|
TokenStream::from(result)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
#[proc_macro]
|
|
35
|
+
#[proc_macro_error]
|
|
36
|
+
pub fn view(input: TokenStream) -> TokenStream {
|
|
37
|
+
let el = parse_macro_input!(input as Element);
|
|
38
|
+
let result = quote! { #el.into() };
|
|
39
|
+
TokenStream::from(result)
|
|
40
|
+
}
|
|
41
|
+
|
|
34
42
|
#[proc_macro_attribute]
|
|
35
43
|
#[proc_macro_error]
|
|
36
44
|
pub fn component(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
src/lib.rs
CHANGED
|
@@ -9,7 +9,7 @@ mod text_element;
|
|
|
9
9
|
pub use self::render::Render;
|
|
10
10
|
pub use fragment::Fragment;
|
|
11
11
|
use tide::{http::mime, StatusCode};
|
|
12
|
-
pub use tide_jsx_impl::{component, html, rsx};
|
|
12
|
+
pub use tide_jsx_impl::{component, html, rsx, view};
|
|
13
13
|
pub use simple_element::SimpleElement;
|
|
14
14
|
pub use text_element::Raw;
|
|
15
15
|
|
tests/lib.rs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
use pretty_assertions::assert_eq;
|
|
2
|
+
use tide::StatusCode;
|
|
2
|
-
use tide_jsx::{html, rsx, component, Render, raw};
|
|
3
|
+
use tide_jsx::{html, rsx, view, component, Render, raw, SimpleElement};
|
|
3
4
|
use tide_jsx::html::HTML5Doctype;
|
|
4
5
|
use std::borrow::Cow;
|
|
5
6
|
|
|
@@ -150,6 +151,12 @@ fn vec() {
|
|
|
150
151
|
)
|
|
151
152
|
}
|
|
152
153
|
|
|
154
|
+
// #[test]
|
|
155
|
+
// fn render_view() {
|
|
156
|
+
// let res = view! { <p>{"hello"}</p> }.into::<tide::Result>();
|
|
157
|
+
// assert_eq!(res.status(), StatusCode::Ok);
|
|
158
|
+
// }
|
|
159
|
+
|
|
153
160
|
mod kaki {
|
|
154
161
|
use crate::{html, rsx, component, HTML5Doctype, Render};
|
|
155
162
|
use crate::other::ExternalPage;
|