@@ -1019,62 +1019,6 @@ where
10191019 render_app_async_with_context ( || { } , app_fn)
10201020}
10211021
1022- /// Returns an Axum [Handler](axum::handler::Handler) that listens for a `GET` request and tries
1023- /// to route it using [leptos_router], asynchronously rendering an HTML page after all
1024- /// `async` resources have loaded.
1025- ///
1026- /// This version allows us to pass Axum State/Extension/Extractor or other info from Axum or network
1027- /// layers above Leptos itself. To use it, you'll need to write your own handler function that provides
1028- /// the data to leptos in a closure. An example is below
1029- /// ```
1030- /// use axum::{
1031- /// body::Body,
1032- /// extract::Path,
1033- /// http::Request,
1034- /// response::{IntoResponse, Response},
1035- /// };
1036- /// use leptos::context::provide_context;
1037- ///
1038- /// async fn custom_handler(
1039- /// Path(id): Path<String>,
1040- /// req: Request<Body>,
1041- /// ) -> Response {
1042- /// let handler = leptos_axum::render_app_async_with_context(
1043- /// move || {
1044- /// provide_context(id.clone());
1045- /// },
1046- /// || { /* your application here */ },
1047- /// );
1048- /// handler(req).await.into_response()
1049- /// }
1050- /// ```
1051- /// Otherwise, this function is identical to [render_app_to_stream].
1052- ///
1053- /// ## Provided Context Types
1054- /// This function always provides context values including the following types:
1055- /// - [`Parts`]
1056- /// - [`ResponseOptions`]
1057- /// - [`ServerMetaContext`]
1058- #[ cfg_attr(
1059- feature = "tracing" ,
1060- tracing:: instrument( level = "trace" , fields( error) , skip_all)
1061- ) ]
1062- #[ deprecated = "Use `render_app_async_with_context` instead" ]
1063- pub fn render_app_async_stream_with_context < IV > (
1064- additional_context : impl Fn ( ) + ' static + Clone + Send + Sync ,
1065- app_fn : impl Fn ( ) -> IV + Clone + Send + Sync + ' static ,
1066- ) -> impl Fn (
1067- Request < Body > ,
1068- ) -> Pin < Box < dyn Future < Output = Response < Body > > + Send + ' static > >
1069- + Clone
1070- + Send
1071- + ' static
1072- where
1073- IV : IntoView + ' static ,
1074- {
1075- render_app_async_with_context ( additional_context, app_fn)
1076- }
1077-
10781022/// Returns an Axum [Handler](axum::handler::Handler) that listens for a `GET` request and tries
10791023/// to route it using [leptos_router], asynchronously rendering an HTML page after all
10801024/// `async` resources have loaded.
0 commit comments