#[non_exhaustive]pub struct HotReloadResult {
pub templates: HashMap<usize, HotReloadedTemplate>,
/* private fields */
}
Expand description
A result of hot reloading
This contains information about what has changed so the hotreloader can apply the right changes
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.templates: HashMap<usize, HotReloadedTemplate>
The child templates we have already used. As we walk through the template tree, we will run into child templates. Each of those child templates also need to be hot reloaded. We keep track of which ones we’ve already hotreloaded to avoid diffing the same template twice against different new templates.
ⓘ
rsx! {
Component { class: "{class}", "{text}" } // The children of a Component is a new template
for item in items {
"{item}" // The children of a for loop is a new template
}
if true {
"{text}" // The children of an if chain is a new template
}
}
If we hotreload the component, we don’t need to hotreload the for loop
You should diff the result of this against the old template to see if you actually need to send down the result
Implementations§
Source§impl HotReloadResult
impl HotReloadResult
Sourcepub fn new<Ctx: HotReloadingContext>(
full_rebuild_state: &TemplateBody,
new: &TemplateBody,
name: String,
) -> Option<Self>
pub fn new<Ctx: HotReloadingContext>( full_rebuild_state: &TemplateBody, new: &TemplateBody, name: String, ) -> Option<Self>
Calculate the hot reload diff between two template bodies
Trait Implementations§
Source§impl Clone for HotReloadResult
impl Clone for HotReloadResult
Source§fn clone(&self) -> HotReloadResult
fn clone(&self) -> HotReloadResult
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for HotReloadResult
impl Debug for HotReloadResult
Source§impl PartialEq for HotReloadResult
impl PartialEq for HotReloadResult
impl StructuralPartialEq for HotReloadResult
Auto Trait Implementations§
impl !Freeze for HotReloadResult
impl !RefUnwindSafe for HotReloadResult
impl !Send for HotReloadResult
impl !Sync for HotReloadResult
impl Unpin for HotReloadResult
impl UnwindSafe for HotReloadResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.