فهرست منبع

add a third party feature for freya

Evan Almloff 1 سال پیش
والد
کامیت
5f8d0f6c40
3فایلهای تغییر یافته به همراه9 افزوده شده و 0 حذف شده
  1. 2 0
      packages/dioxus/Cargo.toml
  2. 4 0
      packages/dioxus/build.rs
  3. 3 0
      packages/dioxus/src/launch.rs

+ 2 - 0
packages/dioxus/Cargo.toml

@@ -54,6 +54,8 @@ salvo = ["dioxus-fullstack?/salvo", "ssr", "dioxus-liveview?/salvo"]
 warp = ["dioxus-fullstack?/warp", "ssr", "dioxus-liveview?/warp"]
 rocket = ["dioxus-liveview?/rocket"]
 tui = ["dioxus-tui", "dioxus-config-macro/tui"]
+# This feature just disables the no-renderer-enabled warning
+third-party-renderer = []
 
 # This feature enables some nightly flags that make it more clear what structs/methods are available in each feature
 nightly-doc = []

+ 4 - 0
packages/dioxus/build.rs

@@ -1,6 +1,10 @@
 fn main() {
 	// Warn the user if they enabled the launch feature without any renderers
     if feature_enabled("launch") {
+		if feature_enabled("third-party-renderer"){
+			return;
+		}
+
 		let liveview_renderers = [
 			"liveview",
 			"axum",

+ 3 - 0
packages/dioxus/src/launch.rs

@@ -211,6 +211,9 @@ mod current_platform {
         contexts: Vec<Box<super::ValidContext>>,
         platform_config: (),
     ) {
+        #[cfg(feature = "third-party-renderer")]
+        panic!("No first party renderer feature enabled. It looks like you are trying to use a third party renderer. You will need to use the launch function from the third party renderer crate.");
+
         panic!("No platform feature enabled. Please enable one of the following features: liveview, desktop, mobile, web, tui, fullstack to use the launch API.");
     }
 }