Skip to main content

HmrHub

Struct HmrHub 

Source
pub struct HmrHub { /* private fields */ }
Expand description

Shared concurrent state coordinating SSE reload notifications, OTA bundles, and server shutdown.

Implementations§

Source§

impl HmrHub

Thread-safe HMR broadcast and OTA bundle coordination for HmrHub.

Source

pub fn new(initial_ota: OtaBundleState) -> Self

Creates a new HmrHub initialized at revision 1 with initial_ota.

§Arguments
  • OtaBundleState - Initial signed Dynamic WASM OTA artifact.
§Returns
  • Self - Initialized hub ready for concurrent access.
Source

pub fn revision(&self) -> u64

Returns the current monotonic rebuild revision counter.

§Arguments
  • &Self - Hub reference.
§Returns
  • u64 - Current revision number.
Source

pub fn publish( &self, kind: HmrEventKind, message: String, changed_files: Vec<String>, ) -> u64

Increments the revision counter and publishes a new HmrEvent to all SSE subscribers.

§Arguments
  • &Self - Hub reference.
  • HmrEventKind - Event variant (Reload, OtaUpdate, or BuildError).
  • String - Human-readable event description.
  • Vec<String> - List of changed source paths.
§Returns
  • u64 - Newly assigned revision number.
Source

pub fn set_ota_state(&self, next_state: OtaBundleState)

Replaces the active signed Dynamic WASM OTA bundle served over HTTP.

§Arguments
  • &Self - Hub reference.
  • OtaBundleState - Freshly compiled and signed OTA artifact.
Source

pub fn current_event(&self) -> Option<HmrEvent>

Returns a cloned copy of the latest published HmrEvent.

§Arguments
  • &Self - Hub reference.
§Returns
  • Option<HmrEvent> - Latest event snapshot.
Source

pub fn ota_snapshot(&self) -> Option<OtaBundleState>

Returns a cloned snapshot of the active OTA manifest and .wasm bytes.

§Arguments
  • &Self - Hub reference.
§Returns
  • Option<OtaBundleState> - Active OTA artifact if lock is unpoisoned.
Source

pub fn stop(&self)

Signals all background HTTP and watcher threads to exit cleanly.

§Arguments
  • &Self - Hub reference.
Source

pub fn is_running(&self) -> bool

Returns true while the dev server has not been shut down.

§Arguments
  • &Self - Hub reference.
§Returns
  • bool - Running state flag.

Trait Implementations§

Source§

impl Debug for HmrHub

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> AnySend for T
where T: Any + Send,

Source§

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

Source§

impl<T> AnySync for T
where T: Any + Sync,

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more