make WebDevResourceConfig optional
This commit is contained in:
1 parent
e11f3fdc48
commit
d51e9b60df
1 file changed
+15
-7
@@ -181,11 +181,7 @@ impl Default for DioxusConfig {
|
|||||||
base_path: None,
|
base_path: None,
|
||||||
},
|
},
|
||||||
proxy: vec![],
|
proxy: vec![],
|
||||||
watcher: WebWatcherConfig {
|
watcher: Default::default(),
|
||||||
watch_path: watch_path_default(),
|
|
||||||
reload_html: false,
|
|
||||||
index_on_404: true,
|
|
||||||
},
|
|
||||||
resource: WebResourceConfig {
|
resource: WebResourceConfig {
|
||||||
dev: WebDevResourceConfig {
|
dev: WebDevResourceConfig {
|
||||||
style: vec![],
|
style: vec![],
|
||||||
@@ -251,7 +247,9 @@ pub struct WebConfig {
|
|||||||
pub app: WebAppConfig,
|
pub app: WebAppConfig,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub proxy: Vec<WebProxyConfig>,
|
pub proxy: Vec<WebProxyConfig>,
|
||||||
|
#[serde(default)]
|
||||||
pub watcher: WebWatcherConfig,
|
pub watcher: WebWatcherConfig,
|
||||||
|
#[serde(default)]
|
||||||
pub resource: WebResourceConfig,
|
pub resource: WebResourceConfig,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub https: WebHttpsConfig,
|
pub https: WebHttpsConfig,
|
||||||
@@ -292,18 +290,28 @@ pub struct WebWatcherConfig {
|
|||||||
pub index_on_404: bool,
|
pub index_on_404: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for WebWatcherConfig {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
watch_path: watch_path_default(),
|
||||||
|
reload_html: false,
|
||||||
|
index_on_404: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn watch_path_default() -> Vec<PathBuf> {
|
fn watch_path_default() -> Vec<PathBuf> {
|
||||||
vec![PathBuf::from("src"), PathBuf::from("examples")]
|
vec![PathBuf::from("src"), PathBuf::from("examples")]
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct WebResourceConfig {
|
pub struct WebResourceConfig {
|
||||||
pub dev: WebDevResourceConfig,
|
pub dev: WebDevResourceConfig,
|
||||||
pub style: Option<Vec<PathBuf>>,
|
pub style: Option<Vec<PathBuf>>,
|
||||||
pub script: Option<Vec<PathBuf>>,
|
pub script: Option<Vec<PathBuf>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct WebDevResourceConfig {
|
pub struct WebDevResourceConfig {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub style: Vec<PathBuf>,
|
pub style: Vec<PathBuf>,
|
||||||
|
|||||||
Reference in new issue
Block a user