1#![forbid(unsafe_code)]
35
36mod font;
37
38pub use font::LocalFont;
39pub use next_rust_cache::{Cache, CacheEntry, CacheKey, CacheOptions, CacheStore, FileStore, MemoryStore};
40pub use next_rust_core::{Config, Diagnostic, Environment, RenderingMode, config, env as dotenv};
41pub use next_rust_macros::{action, asset, client, css_module, global_css, server, server_action};
42pub use next_rust_router::{ParamValue, Params};
43pub use next_rust_server::*;
44pub use next_rust_view::*;
45
46pub use next_rust_ui as ui;
48
49pub use next_rust_icons as icons;
51
52pub mod deps {
54 pub use next_rust_cache as cache;
55 pub use next_rust_core as core;
56 pub use next_rust_router as router;
57 pub use next_rust_server as server;
58 pub use next_rust_view as view;
59}
60
61pub use next_rust_cache::{cache, invalidate};
63pub use next_rust_server::{revalidate_path, revalidate_tag};
65
66pub mod prelude {
68 pub use next_rust_macros::{action, asset, client, css_module, global_css, server, server_action};
69 pub use next_rust_router::Params;
70 pub use next_rust_server::{
71 ActionContext, Auth, AuthUser, Body, ClientIp, Cookie, Cookies, CsrfToken, Data, Error, ErrorInfo, Extension,
72 Feed, FeedEntry, FormState, Headers, Html, IntoResponse, Json, Next, Nonce, OrNotFound, Path, Query, Rendering,
73 Request, RequestInfo, Response, ResponseHeaders, Result, Robots, RobotsRule, SameSite, Session, Sitemap,
74 SitemapEntry, SseEvent, not_found, permanent_redirect, redirect,
75 };
76 pub use next_rust_view::metadata::{Icon, OgImage, OpenGraph, Twitter};
77 pub use next_rust_view::*;
78
79 pub use crate::LocalFont;
80}
81
82#[macro_export]
94macro_rules! routes {
95 () => {
96 #[doc(hidden)]
97 #[allow(non_snake_case, clippy::all, clippy::pedantic)]
98 mod __next_rust_routes {
99 include!(concat!(env!("OUT_DIR"), "/next_rust_routes.rs"));
100 }
101 #[allow(unused_imports)]
102 pub use self::__next_rust_routes::routes;
103 };
104}
105
106#[macro_export]
108macro_rules! app {
109 () => {
110 $crate::routes!();
111
112 fn main() {
113 $crate::run(routes());
114 }
115 };
116}
117
118#[doc(hidden)]
119pub mod __private {
120 pub use next_rust_server::__private::*;
121
122 use next_rust_view::{Element, attrs};
123
124 pub fn to_json_value<T: serde::Serialize + ?Sized>(value: &T) -> serde_json::Value {
125 serde_json::to_value(value).unwrap_or(serde_json::Value::Null)
126 }
127
128 pub fn island_props(entries: &[(&str, serde_json::Value)]) -> String {
129 let map: serde_json::Map<String, serde_json::Value> =
130 entries.iter().map(|(k, v)| ((*k).to_owned(), v.clone())).collect();
131 serde_json::Value::Object(map).to_string()
132 }
133
134 pub fn island(component: &str, module: Option<&str>, props: String, view: impl View) -> Node {
135 let mut el =
136 Element::new("nr-island").with(attrs::data("component", component)).with(attrs::data("props", props));
137 if let Some(m) = module {
138 el = el.with(attrs::data("module", m));
139 }
140 el.with(view).into_node()
141 }
142}