Struct DevServer

Source
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

Source

pub fn new(port: u16, project_dir: &Path) -> Result<Self>

Create a new development server

Source

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

Source

pub fn is_using_beta(&self) -> bool

Check if the dev server is using beta toolchain

Source

pub fn port(&self) -> u16

Get the server port

Source

pub fn hmr_context(&self) -> &Arc<HmrContext>

Get the HMR context

Source

pub fn start(&mut self) -> Result<&JoinHandle<()>>

Start the development server

Source

pub fn broadcast_update(&self, message: String) -> Result<()>

Send an update to all connected WebSocket clients

Source

pub fn send_hmr_update(&self, modules: Vec<String>) -> Result<()>

Trigger an HMR update for specific modules

Source

pub fn send_reload_command(&self) -> Result<()>

Trigger a full page reload for all clients

Source

pub fn send_rebuild_status(&self, status: &str) -> Result<()>

Send rebuild status to all clients

Source

async fn handle_websocket_connection( ws_stream: WebSocketStream<TcpStream>, addr: SocketAddr, rx: Receiver<String>, )

Source

async fn run_websocket_server(port: u16, rx: Receiver<String>) -> Result<()>

Start the WebSocket server

Trait Implementations§

Source§

impl Clone for DevServer

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Any for T
where T: Any,

§

impl<T> CloneAny for T
where T: Any + Clone,

§

impl<T> CloneAnySend for T
where T: Any + Send + Clone,

§

impl<T> CloneAnySendSync for T
where T: Any + Send + Sync + Clone,

§

impl<T> CloneAnySync for T
where T: Any + Sync + Clone,

§

impl<T> ErasedDestructor for T
where T: 'static,