pub struct DevServer {
port: u16,
project_dir: PathBuf,
thread_handle: Option<JoinHandle<()>>,
tx: Option<Sender<String>>,
use_beta: bool,
hmr_context: Arc<HmrContext>,
}
Expand description
Development server
Fields§
§port: u16
Port to use for the server
project_dir: PathBuf
Project directory
thread_handle: Option<JoinHandle<()>>
Server thread handle
tx: Option<Sender<String>>
Broadcast channel for sending updates to connected clients
use_beta: bool
Use beta toolchain for building and testing
hmr_context: Arc<HmrContext>
HMR context for tracking changed modules
Implementations§
Source§impl DevServer
impl DevServer
Sourcepub fn new_with_options(
port: u16,
project_dir: &Path,
use_beta: bool,
) -> Result<Self>
pub fn new_with_options( port: u16, project_dir: &Path, use_beta: bool, ) -> Result<Self>
Create a new development server with optional beta toolchain support
Sourcepub fn is_using_beta(&self) -> bool
pub fn is_using_beta(&self) -> bool
Check if the dev server is using beta toolchain
Sourcepub fn hmr_context(&self) -> &Arc<HmrContext>
pub fn hmr_context(&self) -> &Arc<HmrContext>
Get the HMR context
Sourcepub fn start(&mut self) -> Result<&JoinHandle<()>>
pub fn start(&mut self) -> Result<&JoinHandle<()>>
Start the development server
Sourcepub fn broadcast_update(&self, message: String) -> Result<()>
pub fn broadcast_update(&self, message: String) -> Result<()>
Send an update to all connected WebSocket clients
Sourcepub fn send_hmr_update(&self, modules: Vec<String>) -> Result<()>
pub fn send_hmr_update(&self, modules: Vec<String>) -> Result<()>
Trigger an HMR update for specific modules
Sourcepub fn send_reload_command(&self) -> Result<()>
pub fn send_reload_command(&self) -> Result<()>
Trigger a full page reload for all clients
Sourcepub fn send_rebuild_status(&self, status: &str) -> Result<()>
pub fn send_rebuild_status(&self, status: &str) -> Result<()>
Send rebuild status to all clients
async fn handle_websocket_connection( ws_stream: WebSocketStream<TcpStream>, addr: SocketAddr, rx: Receiver<String>, )
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DevServer
impl !RefUnwindSafe for DevServer
impl Send for DevServer
impl Sync for DevServer
impl Unpin for DevServer
impl !UnwindSafe for DevServer
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more