Merge branch 'master' of github.com:DioxusLabs/dioxus

This commit is contained in:
Jonathan Kelley 2023-02-22 13:06:41 -08:00
commit f664ce8fe0
28 changed files with 110 additions and 62 deletions

View file

@ -40,7 +40,7 @@
<span> | </span> <span> | </span>
<a href="https://github.com/DioxusLabs/example-projects"> Examples </a> <a href="https://github.com/DioxusLabs/example-projects"> Examples </a>
<span> | </span> <span> | </span>
<a href="https://dioxuslabs.com/guide"> Guide </a> <a href="https://dioxuslabs.com/guide/en/"> Guide </a>
<span> | </span> <span> | </span>
<a href="https://github.com/DioxusLabs/dioxus/blob/master/notes/README/ZH_CN.md"> 中文 </a> <a href="https://github.com/DioxusLabs/dioxus/blob/master/notes/README/ZH_CN.md"> 中文 </a>
<span> | </span> <span> | </span>

View file

@ -63,7 +63,7 @@ This very site is built with Dioxus, and the source code is available [here](htt
To get started with Dioxus, check out any of the "Getting Started" guides for your platform of choice, or check out the GitHub Repository for more details. To get started with Dioxus, check out any of the "Getting Started" guides for your platform of choice, or check out the GitHub Repository for more details.
- [Getting Started with Dioxus](https://dioxuslabs.com/guide) - [Getting Started with Dioxus](https://dioxuslabs.com/guide/en)
- [Getting Started with Web](https://dioxuslabs.com/reference/web) - [Getting Started with Web](https://dioxuslabs.com/reference/web)
- [Getting Started with Desktop](https://dioxuslabs.com/reference/desktop) - [Getting Started with Desktop](https://dioxuslabs.com/reference/desktop)
- [Getting Started with Mobile](https://dioxuslabs.com/reference/mobile) - [Getting Started with Mobile](https://dioxuslabs.com/reference/mobile)
@ -163,7 +163,7 @@ Today, to publish a Dioxus app, you don't need NPM/WebPack/Parcel/etc. Dioxus si
## Show me more ## Show me more
Here, we'll dive into some features of Dioxus and why it's so fun to use. The [guide](https://dioxuslabs.com/guide/) serves as a deeper and more comprehensive look at what Dioxus can do. Here, we'll dive into some features of Dioxus and why it's so fun to use. The [guide](https://dioxuslabs.com/guide/en/) serves as a deeper and more comprehensive look at what Dioxus can do.
## Building a new project is simple ## Building a new project is simple

View file

@ -4,7 +4,7 @@
**Dioxus** é um framework e ecossistema para desenvolver interfaces rápidas, escaláveis e robustas com a linguagem de Programação Rust. Este guia irá ajudar você a começar com o Dioxus para Web, Desktop, Móvel e mais. **Dioxus** é um framework e ecossistema para desenvolver interfaces rápidas, escaláveis e robustas com a linguagem de Programação Rust. Este guia irá ajudar você a começar com o Dioxus para Web, Desktop, Móvel e mais.
> Este livro é a Referência e Guias Avançados para o framework Dioxus. Para um tutorial em como de fato _usar_ o Dioxus, procure o [guia oficial](https://dioxuslabs.com/guide/). > Este livro é a Referência e Guias Avançados para o framework Dioxus. Para um tutorial em como de fato _usar_ o Dioxus, procure o [guia oficial](https://dioxuslabs.com/guide/en/).
## Guias e Referência ## Guias e Referência

View file

@ -42,4 +42,4 @@ To configure the webview, menubar, and other important desktop-specific features
## Future Steps ## Future Steps
Make sure to read the [Dioxus Guide](https://dioxuslabs.com/guide) if you already haven't! Make sure to read the [Dioxus Guide](https://dioxuslabs.com/guide/en) if you already haven't!

View file

@ -40,7 +40,7 @@
<span> | </span> <span> | </span>
<a href="https://github.com/DioxusLabs/example-projects"> 代码示例 </a> <a href="https://github.com/DioxusLabs/example-projects"> 代码示例 </a>
<span> | </span> <span> | </span>
<a href="https://dioxuslabs.com/guide"> 开发指南 </a> <a href="https://dioxuslabs.com/guide/en"> 开发指南 </a>
<span> | </span> <span> | </span>
<a href="https://github.com/DioxusLabs/dioxus/blob/master/README.md"> English </a> <a href="https://github.com/DioxusLabs/dioxus/blob/master/README.md"> English </a>
<span> | </span> <span> | </span>

View file

@ -19,7 +19,7 @@
[discord-url]: https://discord.gg/XgGxMSkvUM [discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) | [Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/guide/) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en/) |
[API Docs](https://docs.rs/dioxus-autofmt/latest/dioxus_autofmt) | [API Docs](https://docs.rs/dioxus-autofmt/latest/dioxus_autofmt) |
[Chat](https://discord.gg/XgGxMSkvUM) [Chat](https://discord.gg/XgGxMSkvUM)

View file

@ -19,7 +19,7 @@
[discord-url]: https://discord.gg/XgGxMSkvUM [discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) | [Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/guide/) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en/) |
[API Docs](https://docs.rs/dioxus-core-macro/latest/dioxus_core_macro) | [API Docs](https://docs.rs/dioxus-core-macro/latest/dioxus_core_macro) |
[Chat](https://discord.gg/XgGxMSkvUM) [Chat](https://discord.gg/XgGxMSkvUM)

View file

@ -19,7 +19,7 @@
[discord-url]: https://discord.gg/XgGxMSkvUM [discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) | [Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/guide/) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en/) |
[API Docs](https://docs.rs/dioxus-desktop/latest/dioxus_desktop) | [API Docs](https://docs.rs/dioxus-desktop/latest/dioxus_desktop) |
[Chat](https://discord.gg/XgGxMSkvUM) [Chat](https://discord.gg/XgGxMSkvUM)
@ -30,7 +30,7 @@
This requires that webview is installed on the target system. WebView is installed by default on macOS and iOS devices, but might not come preinstalled on Windows or Linux devices. To fix these issues, follow the [instructions in the guide](guide-url). This requires that webview is installed on the target system. WebView is installed by default on macOS and iOS devices, but might not come preinstalled on Windows or Linux devices. To fix these issues, follow the [instructions in the guide](guide-url).
[guide-url]: https://dioxuslabs.com/guide/setup.html#platform-specific-dependencies [guide-url]: https://dioxuslabs.com/docs/0.3/guide/en/getting_started/desktop.html

View file

@ -49,4 +49,4 @@ To configure the webview, menubar, and other important desktop-specific features
## Future Steps ## Future Steps
Make sure to read the [Dioxus Guide](https://dioxuslabs.com/guide) if you already haven't! Make sure to read the [Dioxus Guide](https://dioxuslabs.com/docs/0.3/guide/en) if you already haven't!

View file

@ -9,9 +9,8 @@
This overview provides a brief introduction to Dioxus. For a more in-depth guide, make sure to check out: This overview provides a brief introduction to Dioxus. For a more in-depth guide, make sure to check out:
- [Getting Started](https://dioxuslabs.com/guide/setup.html) - [Getting Started](https://dioxuslabs.com/docs/0.3/guide/en/getting_started/index.html)
- [Book](https://dioxuslabs.com/guide/) - [Book](https://dioxuslabs.com/docs/0.3/guide/en/)
- [Reference](https://dioxuslabs.com/reference)
- [Examples](https://github.com/DioxusLabs/example-projects) - [Examples](https://github.com/DioxusLabs/example-projects)
# Overview and Goals # Overview and Goals

View file

@ -19,7 +19,7 @@
[discord-url]: https://discord.gg/XgGxMSkvUM [discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) | [Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/guide/) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en/) |
[API Docs](https://docs.rs/dioxus-hooks/latest/dioxus_hooks) | [API Docs](https://docs.rs/dioxus-hooks/latest/dioxus_hooks) |
[Chat](https://discord.gg/XgGxMSkvUM) [Chat](https://discord.gg/XgGxMSkvUM)

View file

@ -108,6 +108,12 @@ impl<T> Coroutine<T> {
} }
} }
impl<T> PartialEq for Coroutine<T> {
fn eq(&self, other: &Self) -> bool {
self.task == other.task
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
#![allow(unused)] #![allow(unused)]

View file

@ -329,7 +329,7 @@ impl PartialEq<bool> for &UseState<bool> {
} }
} }
impl<T: PartialEq> PartialEq<UseState<T>> for UseState<T> { impl<T> PartialEq<UseState<T>> for UseState<T> {
fn eq(&self, other: &UseState<T>) -> bool { fn eq(&self, other: &UseState<T>) -> bool {
Rc::ptr_eq(&self.current_val, &other.current_val) Rc::ptr_eq(&self.current_val, &other.current_val)
} }

View file

@ -19,7 +19,7 @@
[discord-url]: https://discord.gg/XgGxMSkvUM [discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) | [Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/guide/) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en) |
[API Docs](https://docs.rs/dioxus-hot-reload/latest/dioxus_hot_reload) | [API Docs](https://docs.rs/dioxus-hot-reload/latest/dioxus_hot_reload) |
[Chat](https://discord.gg/XgGxMSkvUM) [Chat](https://discord.gg/XgGxMSkvUM)

View file

@ -7,7 +7,7 @@ use std::{
use dioxus_core::Template; use dioxus_core::Template;
use dioxus_rsx::{ use dioxus_rsx::{
hot_reload::{FileMap, UpdateResult}, hot_reload::{FileMap, FileMapBuildResult, UpdateResult},
HotReloadingContext, HotReloadingContext,
}; };
use interprocess::local_socket::{LocalSocketListener, LocalSocketStream}; use interprocess::local_socket::{LocalSocketListener, LocalSocketStream};
@ -141,17 +141,24 @@ pub fn init<Ctx: HotReloadingContext + Send + 'static>(cfg: Config<Ctx>) {
let temp_file = std::env::temp_dir().join("@dioxusin"); let temp_file = std::env::temp_dir().join("@dioxusin");
let channels = Arc::new(Mutex::new(Vec::new())); let channels = Arc::new(Mutex::new(Vec::new()));
let file_map = Arc::new(Mutex::new(FileMap::<Ctx>::new_with_filter( let FileMapBuildResult {
crate_dir.clone(), map: file_map,
|path| { errors,
// skip excluded paths } = FileMap::<Ctx>::create_with_filter(crate_dir.clone(), |path| {
excluded_paths.iter().any(|p| path.starts_with(p)) || // skip excluded paths
excluded_paths.iter().any(|p| path.starts_with(p)) ||
// respect .gitignore // respect .gitignore
gitignore gitignore
.matched_path_or_any_parents(path, path.is_dir()) .matched_path_or_any_parents(path, path.is_dir())
.is_ignore() .is_ignore()
}, })
))); .unwrap();
for err in errors {
if log {
println!("hot reloading failed to initialize:\n{err:?}");
}
}
let file_map = Arc::new(Mutex::new(file_map));
if let Ok(local_socket_stream) = LocalSocketListener::bind(temp_file.as_path()) { if let Ok(local_socket_stream) = LocalSocketListener::bind(temp_file.as_path()) {
let aborted = Arc::new(Mutex::new(false)); let aborted = Arc::new(Mutex::new(false));
@ -283,7 +290,7 @@ pub fn init<Ctx: HotReloadingContext + Send + 'static>(cfg: Config<Ctx>) {
.unwrap() .unwrap()
.update_rsx(path, crate_dir.as_path()) .update_rsx(path, crate_dir.as_path())
{ {
UpdateResult::UpdatedRsx(msgs) => { Ok(UpdateResult::UpdatedRsx(msgs)) => {
for msg in msgs { for msg in msgs {
let mut i = 0; let mut i = 0;
while i < channels.len() { while i < channels.len() {
@ -299,13 +306,20 @@ pub fn init<Ctx: HotReloadingContext + Send + 'static>(cfg: Config<Ctx>) {
} }
} }
} }
UpdateResult::NeedsRebuild => { Ok(UpdateResult::NeedsRebuild) => {
drop(channels); drop(channels);
if rebuild() { if rebuild() {
return; return;
} }
break; break;
} }
Err(err) => {
if log {
println!(
"hot reloading failed to update rsx:\n{err:?}"
);
}
}
} }
} }
} }

View file

@ -19,7 +19,7 @@
[discord-url]: https://discord.gg/XgGxMSkvUM [discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) | [Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/guide/) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en/) |
[API Docs](https://docs.rs/dioxus-html/latest/dioxus_html) | [API Docs](https://docs.rs/dioxus-html/latest/dioxus_html) |
[Chat](https://discord.gg/XgGxMSkvUM) [Chat](https://discord.gg/XgGxMSkvUM)

View file

@ -19,7 +19,7 @@
[discord-url]: https://discord.gg/XgGxMSkvUM [discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) | [Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/guide/) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en/) |
[API Docs](https://docs.rs/dioxus-interpreter-js/latest/dioxus_interpreter_js) | [API Docs](https://docs.rs/dioxus-interpreter-js/latest/dioxus_interpreter_js) |
[Chat](https://discord.gg/XgGxMSkvUM) [Chat](https://discord.gg/XgGxMSkvUM)

View file

@ -19,7 +19,7 @@
[discord-url]: https://discord.gg/XgGxMSkvUM [discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) | [Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/guide/) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en/) |
[API Docs](https://docs.rs/dioxus-liveview/latest/dioxus_liveview) | [API Docs](https://docs.rs/dioxus-liveview/latest/dioxus_liveview) |
[Chat](https://discord.gg/XgGxMSkvUM) [Chat](https://discord.gg/XgGxMSkvUM)

View file

@ -18,7 +18,7 @@
[discord-url]: https://discord.gg/XgGxMSkvUM [discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) | [Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/guide/) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en/) |
[API Docs](https://docs.rs/dioxus-mobile/latest/dioxus_mobile) | [API Docs](https://docs.rs/dioxus-mobile/latest/dioxus_mobile) |
[Chat](https://discord.gg/XgGxMSkvUM) [Chat](https://discord.gg/XgGxMSkvUM)
@ -98,7 +98,7 @@ To configure the web view, menubar, and other important desktop-specific feature
## Future Steps ## Future Steps
Make sure to read the [Dioxus Guide](https://dioxuslabs.com/guide) if you already haven't! Make sure to read the [Dioxus Guide](https://dioxuslabs.com/docs/0.3/guide/en) if you already haven't!

View file

@ -18,7 +18,7 @@
[discord-url]: https://discord.gg/XgGxMSkvUM [discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) | [Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/guide/) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en/) |
[API Docs](https://docs.rs/dioxus-native-core-macro/latest/dioxus_native_core_macro) | [API Docs](https://docs.rs/dioxus-native-core-macro/latest/dioxus_native_core_macro) |
[Chat](https://discord.gg/XgGxMSkvUM) [Chat](https://discord.gg/XgGxMSkvUM)

View file

@ -18,7 +18,7 @@
[discord-url]: https://discord.gg/XgGxMSkvUM [discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) | [Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/guide/) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en/) |
[API Docs](https://docs.rs/dioxus-native-core/latest/dioxus_native_core) | [API Docs](https://docs.rs/dioxus-native-core/latest/dioxus_native_core) |
[Chat](https://discord.gg/XgGxMSkvUM) [Chat](https://discord.gg/XgGxMSkvUM)

View file

@ -18,7 +18,7 @@
[discord-url]: https://discord.gg/XgGxMSkvUM [discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) | [Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/guide/) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en/) |
[API Docs](https://docs.rs/dioxus-router/latest/dioxus_router) | [API Docs](https://docs.rs/dioxus-router/latest/dioxus_router) |
[Chat](https://discord.gg/XgGxMSkvUM) [Chat](https://discord.gg/XgGxMSkvUM)

View file

@ -20,7 +20,7 @@
[discord-url]: https://discord.gg/XgGxMSkvUM [discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) | [Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/guide/) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en/) |
[API Docs](https://docs.rs/rsx-rosetta/latest/rsx-rosetta) | [API Docs](https://docs.rs/rsx-rosetta/latest/rsx-rosetta) |
[Chat](https://discord.gg/XgGxMSkvUM) [Chat](https://discord.gg/XgGxMSkvUM)

View file

@ -18,7 +18,7 @@
[discord-url]: https://discord.gg/XgGxMSkvUM [discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) | [Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/guide/) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en/) |
[API Docs](https://docs.rs/dioxus-rsx/latest/dioxus_rsx) | [API Docs](https://docs.rs/dioxus-rsx/latest/dioxus_rsx) |
[Chat](https://discord.gg/XgGxMSkvUM) [Chat](https://discord.gg/XgGxMSkvUM)

View file

@ -17,6 +17,14 @@ pub enum UpdateResult {
NeedsRebuild, NeedsRebuild,
} }
/// The result of building a FileMap
pub struct FileMapBuildResult<Ctx: HotReloadingContext> {
/// The FileMap that was built
pub map: FileMap<Ctx>,
/// Any errors that occurred while building the FileMap that were not fatal
pub errors: Vec<io::Error>,
}
pub struct FileMap<Ctx: HotReloadingContext> { pub struct FileMap<Ctx: HotReloadingContext> {
pub map: HashMap<PathBuf, (String, Option<Template<'static>>)>, pub map: HashMap<PathBuf, (String, Option<Template<'static>>)>,
phantom: std::marker::PhantomData<Ctx>, phantom: std::marker::PhantomData<Ctx>,
@ -24,46 +32,63 @@ pub struct FileMap<Ctx: HotReloadingContext> {
impl<Ctx: HotReloadingContext> FileMap<Ctx> { impl<Ctx: HotReloadingContext> FileMap<Ctx> {
/// Create a new FileMap from a crate directory /// Create a new FileMap from a crate directory
pub fn new(path: PathBuf) -> Self { pub fn create(path: PathBuf) -> io::Result<FileMapBuildResult<Ctx>> {
Self::new_with_filter(path, |_| false) Self::create_with_filter(path, |_| false)
} }
/// Create a new FileMap from a crate directory /// Create a new FileMap from a crate directory
pub fn new_with_filter(path: PathBuf, mut filter: impl FnMut(&Path) -> bool) -> Self { pub fn create_with_filter(
path: PathBuf,
mut filter: impl FnMut(&Path) -> bool,
) -> io::Result<FileMapBuildResult<Ctx>> {
struct FileMapSearchResult {
map: HashMap<PathBuf, (String, Option<Template<'static>>)>,
errors: Vec<io::Error>,
}
fn find_rs_files( fn find_rs_files(
root: PathBuf, root: PathBuf,
filter: &mut impl FnMut(&Path) -> bool, filter: &mut impl FnMut(&Path) -> bool,
) -> io::Result<HashMap<PathBuf, (String, Option<Template<'static>>)>> { ) -> io::Result<FileMapSearchResult> {
let mut files = HashMap::new(); let mut files = HashMap::new();
let mut errors = Vec::new();
if root.is_dir() { if root.is_dir() {
for entry in (fs::read_dir(root)?).flatten() { for entry in (fs::read_dir(root)?).flatten() {
let path = entry.path(); let path = entry.path();
if !filter(&path) { if !filter(&path) {
files.extend(find_rs_files(path, filter)?); let FileMapSearchResult {
map,
errors: child_errors,
} = find_rs_files(path, filter)?;
errors.extend(child_errors);
files.extend(map);
} }
} }
} else if root.extension().and_then(|s| s.to_str()) == Some("rs") { } else if root.extension().and_then(|s| s.to_str()) == Some("rs") {
if let Ok(mut file) = File::open(root.clone()) { if let Ok(mut file) = File::open(root.clone()) {
let mut src = String::new(); let mut src = String::new();
file.read_to_string(&mut src).expect("Unable to read file"); file.read_to_string(&mut src)?;
files.insert(root, (src, None)); files.insert(root, (src, None));
} }
} }
Ok(files) Ok(FileMapSearchResult { map: files, errors })
} }
let FileMapSearchResult { map, errors } = find_rs_files(path, &mut filter)?;
let result = Self { let result = Self {
map: find_rs_files(path, &mut filter).unwrap(), map,
phantom: std::marker::PhantomData, phantom: std::marker::PhantomData,
}; };
result Ok(FileMapBuildResult {
map: result,
errors,
})
} }
/// Try to update the rsx in a file /// Try to update the rsx in a file
pub fn update_rsx(&mut self, file_path: &Path, crate_dir: &Path) -> UpdateResult { pub fn update_rsx(&mut self, file_path: &Path, crate_dir: &Path) -> io::Result<UpdateResult> {
let mut file = File::open(file_path).unwrap(); let mut file = File::open(file_path)?;
let mut src = String::new(); let mut src = String::new();
file.read_to_string(&mut src).expect("Unable to read file"); file.read_to_string(&mut src)?;
if let Ok(syntax) = syn::parse_file(&src) { if let Ok(syntax) = syn::parse_file(&src) {
if let Some((old_src, template_slot)) = self.map.get_mut(file_path) { if let Some((old_src, template_slot)) = self.map.get_mut(file_path) {
if let Ok(old) = syn::parse_file(old_src) { if let Ok(old) = syn::parse_file(old_src) {
@ -99,7 +124,7 @@ impl<Ctx: HotReloadingContext> FileMap<Ctx> {
{ {
// dioxus cannot handle empty templates // dioxus cannot handle empty templates
if template.roots.is_empty() { if template.roots.is_empty() {
return UpdateResult::NeedsRebuild; return Ok(UpdateResult::NeedsRebuild);
} else { } else {
// if the template is the same, don't send it // if the template is the same, don't send it
if let Some(old_template) = template_slot { if let Some(old_template) = template_slot {
@ -111,20 +136,25 @@ impl<Ctx: HotReloadingContext> FileMap<Ctx> {
messages.push(template); messages.push(template);
} }
} else { } else {
return UpdateResult::NeedsRebuild; return Ok(UpdateResult::NeedsRebuild);
} }
} }
} }
} }
return UpdateResult::UpdatedRsx(messages); return Ok(UpdateResult::UpdatedRsx(messages));
} }
} }
} }
} else { } else {
// if this is a new file, rebuild the project // if this is a new file, rebuild the project
*self = FileMap::new(crate_dir.to_path_buf()); let FileMapBuildResult { map, mut errors } =
FileMap::create(crate_dir.to_path_buf())?;
if let Some(err) = errors.pop() {
return Err(err);
}
*self = map;
} }
} }
UpdateResult::NeedsRebuild Ok(UpdateResult::NeedsRebuild)
} }
} }

View file

@ -8,10 +8,9 @@
## Resources ## Resources
This crate is a part of the broader Dioxus ecosystem. For more resources about Dioxus, check out: This crate is a part of the broader Dioxus ecosystem. For more resources about Dioxus, check out:
- [Getting Started](https://dioxuslabs.com/getting-started) - [Getting Started](https://dioxuslabs.com/docs/0.3/guide/en/getting_started/index.html)
- [Book](https://dioxuslabs.com/book) - [Book](https://dioxuslabs.com/docs/0.3/guide/en/)
- [Reference](https://dioxuslabs.com/reference) - [Examples](https://github.com/DioxusLabs/example-projects)
- [Community Examples](https://github.com/DioxusLabs/community-examples)
## Overview ## Overview

View file

@ -18,7 +18,7 @@
[discord-url]: https://discord.gg/XgGxMSkvUM [discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) | [Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/guide/) | [Guides](https://dioxuslabs.com/docs/0.3/guide/en/) |
[API Docs](https://docs.rs/dioxus-web/latest/dioxus_web) | [API Docs](https://docs.rs/dioxus-web/latest/dioxus_web) |
[Chat](https://discord.gg/XgGxMSkvUM) [Chat](https://discord.gg/XgGxMSkvUM)

View file

@ -40,7 +40,7 @@
<span> | </span> <span> | </span>
<a href="https://github.com/DioxusLabs/example-projects"> Exemplos </a> <a href="https://github.com/DioxusLabs/example-projects"> Exemplos </a>
<span> | </span> <span> | </span>
<a href="https://dioxuslabs.com/guide"> Guia </a> <a href="https://dioxuslabs.com/guide/pt-br"> Guia </a>
<span> | </span> <span> | </span>
<a href="https://github.com/DioxusLabs/dioxus/blob/master/notes/README/ZH_CN.md"> 中文 </a> <a href="https://github.com/DioxusLabs/dioxus/blob/master/notes/README/ZH_CN.md"> 中文 </a>
</h3> </h3>
@ -83,7 +83,7 @@ Se você conhece React, então você já conhece o Dioxus.
<table style="width:100%" align="center"> <table style="width:100%" align="center">
<tr> <tr>
<th><a href="https://dioxuslabs.com/guide/">Tutorial</a></th> <th><a href="https://dioxuslabs.com/guide/pt-br/">Tutorial</a></th>
<th><a href="https://dioxuslabs.com/reference/web">Web</a></th> <th><a href="https://dioxuslabs.com/reference/web">Web</a></th>
<th><a href="https://dioxuslabs.com/reference/desktop/">Desktop</a></th> <th><a href="https://dioxuslabs.com/reference/desktop/">Desktop</a></th>
<th><a href="https://dioxuslabs.com/reference/ssr/">SSR</a></th> <th><a href="https://dioxuslabs.com/reference/ssr/">SSR</a></th>
@ -159,7 +159,7 @@ Dioxus é único no ecossistema do Rust por suportar:
- SSR com `hydration` feito pelo Cliente - SSR com `hydration` feito pelo Cliente
- Suporte à aplicação Desktop - Suporte à aplicação Desktop
Para mais informações sobre quais funções estão atualmente disponíveis e para o progresso futuro, veja [O Guia](https://dioxuslabs.com/guide/). Para mais informações sobre quais funções estão atualmente disponíveis e para o progresso futuro, veja [O Guia](https://dioxuslabs.com/guide/pt-br/).
## Projeto dentro do ecossistema Dioxus ## Projeto dentro do ecossistema Dioxus