use boxed slices instead of vecs where possible
This commit is contained in:
1 parent
c59926cb1f
commit
aefa8a2431
9 files changed
+53
-46
No files matched your search
@@ -15,7 +15,7 @@ use syn::spanned::Spanned;
|
||||
use super::hot_reload_diff::{find_rsx, DiffResult};
|
||||
|
||||
pub enum UpdateResult {
|
||||
UpdatedRsx(Vec<Template<'static>>),
|
||||
UpdatedRsx(Vec<Template>),
|
||||
NeedsRebuild,
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ pub struct FileMapBuildResult<Ctx: HotReloadingContext> {
|
||||
}
|
||||
|
||||
pub struct FileMap<Ctx: HotReloadingContext> {
|
||||
pub map: HashMap<PathBuf, (String, Option<Template<'static>>)>,
|
||||
pub map: HashMap<PathBuf, (String, Option<Template>)>,
|
||||
in_workspace: HashMap<PathBuf, Option<PathBuf>>,
|
||||
phantom: std::marker::PhantomData<Ctx>,
|
||||
}
|
||||
@@ -45,7 +45,7 @@ impl<Ctx: HotReloadingContext> FileMap<Ctx> {
|
||||
mut filter: impl FnMut(&Path) -> bool,
|
||||
) -> io::Result<FileMapBuildResult<Ctx>> {
|
||||
struct FileMapSearchResult {
|
||||
map: HashMap<PathBuf, (String, Option<Template<'static>>)>,
|
||||
map: HashMap<PathBuf, (String, Option<Template>)>,
|
||||
errors: Vec<io::Error>,
|
||||
}
|
||||
fn find_rs_files(
|
||||
@@ -115,7 +115,7 @@ impl<Ctx: HotReloadingContext> FileMap<Ctx> {
|
||||
self.map.insert(file_path.to_path_buf(), (src, None));
|
||||
}
|
||||
DiffResult::RsxChanged(changed) => {
|
||||
let mut messages: Vec<Template<'static>> = Vec::new();
|
||||
let mut messages: Vec<Template> = Vec::new();
|
||||
for (old, new) in changed.into_iter() {
|
||||
let old_start = old.span().start();
|
||||
|
||||
|
||||
@@ -256,9 +256,9 @@ impl<'a> ToTokens for TemplateRenderer<'a> {
|
||||
::dioxus::core::VNode::new(
|
||||
#key_tokens,
|
||||
TEMPLATE,
|
||||
Vec::with_capacity(#root_count),
|
||||
vec![ #( #node_printer ),* ],
|
||||
vec![ #( #dyn_attr_printer ),* ],
|
||||
Box::new([Default::default();#root_count]),
|
||||
Box::new([ #( #node_printer ),* ]),
|
||||
Box::new([ #( #dyn_attr_printer ),* ]),
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user