use dioxus_core::internal::HotReloadTemplateWithLocation;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use subsecond_types::JumpTable;
#[non_exhaustive]
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub enum DevserverMsg {
HotReload(HotReloadMsg),
HotPatchStart,
FullReloadStart,
FullReloadFailed,
FullReloadCommand,
Shutdown,
}
#[non_exhaustive]
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub enum ClientMsg {
Log {
level: String,
messages: Vec<String>,
},
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct HotReloadMsg {
pub templates: Vec<HotReloadTemplateWithLocation>,
pub assets: Vec<PathBuf>,
pub ms_elapsed: u64,
pub jump_table: Option<JumpTable>,
pub for_build_id: Option<u64>,
pub for_pid: Option<u32>,
}
impl HotReloadMsg {
pub fn is_empty(&self) -> bool {
self.templates.is_empty() && self.assets.is_empty() && self.jump_table.is_none()
}
}