feat: allow using Actix without default features (#3921)

This commit is contained in:
Dylan Anthony
2025-07-20 06:03:49 -06:00
committed by GitHub
parent 7f93dd224d
commit 956af8e466
7 changed files with 25 additions and 9 deletions

View File

@@ -11,7 +11,7 @@ edition.workspace = true
[dependencies]
actix-http = { workspace = true, default-features = true }
actix-files = { workspace = true, default-features = true }
actix-web = { workspace = true, default-features = true }
actix-web = { workspace = true, default-features = false }
futures = { workspace = true, default-features = true }
any_spawner = { workspace = true, features = ["tokio"] }
hydration_context = { workspace = true }
@@ -20,7 +20,7 @@ leptos_integration_utils = { workspace = true }
leptos_macro = { workspace = true, features = ["actix"] }
leptos_meta = { workspace = true, features = ["nonce"] }
leptos_router = { workspace = true, features = ["ssr"] }
server_fn = { workspace = true, features = ["actix"] }
server_fn = { workspace = true, features = ["actix-no-default"] }
tachys = { workspace = true }
serde_json = { workspace = true , default-features = true }
parking_lot = { workspace = true, default-features = true }
@@ -33,6 +33,8 @@ dashmap = { workspace = true, default-features = true }
rustdoc-args = ["--generate-link-to-definition"]
[features]
default = ["actix-default"]
actix-default = ["actix-web/default"]
islands-router = ["tachys/islands"]
tracing = ["dep:tracing"]

View File

@@ -282,6 +282,7 @@ pub fn redirect(path: &str) {
/// // call ServerFn::register() for each of the server functions you've defined
/// }
///
/// # #[cfg(feature = "default")]
/// #[actix_web::main]
/// async fn main() -> std::io::Result<()> {
/// // make sure you actually register your server functions
@@ -297,6 +298,8 @@ pub fn redirect(path: &str) {
/// .run()
/// .await
/// }
/// # #[cfg(not(feature = "default"))]
/// # fn main() {}
/// ```
///
/// ## Provided Context Types
@@ -442,6 +445,7 @@ pub fn handle_server_fns_with_context(
/// view! { <main>"Hello, world!"</main> }
/// }
///
/// # #[cfg(feature = "default")]
/// #[actix_web::main]
/// async fn main() -> std::io::Result<()> {
/// let conf = get_configuration(Some("Cargo.toml")).unwrap();
@@ -461,6 +465,8 @@ pub fn handle_server_fns_with_context(
/// .run()
/// .await
/// }
/// # #[cfg(not(feature = "default"))]
/// # fn main() {}
/// ```
///
/// ## Provided Context Types
@@ -499,6 +505,7 @@ where
/// view! { <main>"Hello, world!"</main> }
/// }
///
/// # #[cfg(feature = "default")]
/// #[actix_web::main]
/// async fn main() -> std::io::Result<()> {
/// let conf = get_configuration(Some("Cargo.toml")).unwrap();
@@ -521,6 +528,9 @@ where
/// .run()
/// .await
/// }
///
/// # #[cfg(not(feature = "default"))]
/// # fn main() {}
/// ```
///
/// ## Provided Context Types
@@ -557,6 +567,7 @@ where
/// view! { <main>"Hello, world!"</main> }
/// }
///
/// # #[cfg(feature = "default")]
/// #[actix_web::main]
/// async fn main() -> std::io::Result<()> {
/// let conf = get_configuration(Some("Cargo.toml")).unwrap();
@@ -576,6 +587,8 @@ where
/// .run()
/// .await
/// }
/// # #[cfg(not(feature = "default"))]
/// # fn main() {}
/// ```
///
/// ## Provided Context Types