}
@@ -54,16 +58,13 @@ async fn main() -> eyre::Result<()> {
.with(tracing_subscriber::fmt::layer()),
)?;
+ let amount_of_refreshes = Arc::new(AtomicU64::new(0));
let app = axum::Router::new().route("/", get(index)).route("/widget", get(|| async move {
- let ts = std::time::SystemTime::now()
- .duration_since(std::time::UNIX_EPOCH)
- .unwrap()
- .as_secs();
- vespid::axum_compat::render(async move {
- html! {
-
+ render(async move {
+ view! {
+
}
}).await
diff --git a/vespid/macros/src/lib.rs b/vespid/macros/src/lib.rs
index 434caed..37812da 100644
--- a/vespid/macros/src/lib.rs
+++ b/vespid/macros/src/lib.rs
@@ -4,18 +4,30 @@ use proc_macro::TokenStream;
use proc_macro2_diagnostics::Diagnostic;
use quote::{quote, quote_spanned, ToTokens};
use rstml::{
- node::{KeyedAttribute, Node, NodeAttribute, NodeElement, NodeName}, Infallible, Parser, ParserConfig
+ node::{KeyedAttribute, Node, NodeAttribute, NodeElement, NodeName},
+ Infallible,
+ Parser,
+ ParserConfig,
+};
+use syn::{
+ parse::Parse,
+ parse_quote,
+ punctuated::Punctuated,
+ spanned::Spanned,
+ Expr,
+ ExprLit,
+ FnArg,
+ ItemStruct,
+ Token,
};
-use syn::punctuated::Punctuated;
-use syn::{parse::Parse, parse_quote, spanned::Spanned, Expr, ExprLit, FnArg, ItemStruct, Token};
#[proc_macro]
-pub fn html(tokens: TokenStream) -> TokenStream {
+pub fn view(tokens: TokenStream) -> TokenStream {
html_inner(tokens, false)
}
#[proc_macro]
-pub fn html_ide(tokens: TokenStream) -> TokenStream {
+pub fn view_docs(tokens: TokenStream) -> TokenStream {
html_inner(tokens, true)
}
diff --git a/vespid/src/axum_compat.rs b/vespid/src/axum_compat.rs
index abf8139..956820f 100644
--- a/vespid/src/axum_compat.rs
+++ b/vespid/src/axum_compat.rs
@@ -1,5 +1,6 @@
-use axum::response::Html;
use std::{future::Future, sync::OnceLock, thread::available_parallelism};
+
+use axum::response::Html;
use tokio_util::task::LocalPoolHandle;
use crate::context;
diff --git a/vespid/src/lib.rs b/vespid/src/lib.rs
index ff63718..4d48e50 100644
--- a/vespid/src/lib.rs
+++ b/vespid/src/lib.rs
@@ -18,7 +18,7 @@ pub mod axum_compat;
pub use vespid_macros::*;
-#[doc(hidden)]
-pub extern crate typed_builder;
#[doc(hidden)]
pub extern crate html_escape;
+#[doc(hidden)]
+pub extern crate typed_builder;
diff --git a/vespid/src/render.rs b/vespid/src/render.rs
index 06ca52c..ea67c0f 100644
--- a/vespid/src/render.rs
+++ b/vespid/src/render.rs
@@ -6,8 +6,18 @@ use std::{
io::ErrorKind,
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6},
num::{
- NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroIsize, NonZeroU128,
- NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize,
+ NonZeroI128,
+ NonZeroI16,
+ NonZeroI32,
+ NonZeroI64,
+ NonZeroI8,
+ NonZeroIsize,
+ NonZeroU128,
+ NonZeroU16,
+ NonZeroU32,
+ NonZeroU64,
+ NonZeroU8,
+ NonZeroUsize,
},
rc::Rc,
sync::{