pub struct NextjsBootstrapState { /* private fields */ }Expand description
Next.js client bootstrap state machine.
This tracks hydration-safe runtime initialization with explicit phase transitions, deterministic history, and idempotent re-entry behavior.
Implementations§
Source§impl NextjsBootstrapState
impl NextjsBootstrapState
Sourcepub fn phase(&self) -> NextjsBootstrapPhase
pub fn phase(&self) -> NextjsBootstrapPhase
Returns current bootstrap phase.
Sourcepub fn hydration_cycle_count(&self) -> u32
pub fn hydration_cycle_count(&self) -> u32
Returns number of hydration cycles observed.
Sourcepub fn runtime_generation(&self) -> u32
pub fn runtime_generation(&self) -> u32
Returns runtime generation counter.
This increments every time bootstrap reaches RuntimeReady.
Returns number of navigation events processed.
Sourcepub fn hot_reload_count(&self) -> u32
pub fn hot_reload_count(&self) -> u32
Returns number of hot-reload events processed.
Sourcepub fn last_failure(&self) -> Option<&str>
pub fn last_failure(&self) -> Option<&str>
Returns last runtime initialization failure reason, if any.
Sourcepub fn transition_log(&self) -> &[NextjsBootstrapTransitionRecord]
pub fn transition_log(&self) -> &[NextjsBootstrapTransitionRecord]
Returns deterministic transition history.
Sourcepub fn start_hydration(
&mut self,
) -> Result<bool, NextjsBootstrapTransitionError>
pub fn start_hydration( &mut self, ) -> Result<bool, NextjsBootstrapTransitionError>
Starts hydration.
This is idempotent when already in Hydrating.
Sourcepub fn complete_hydration(
&mut self,
) -> Result<bool, NextjsBootstrapTransitionError>
pub fn complete_hydration( &mut self, ) -> Result<bool, NextjsBootstrapTransitionError>
Completes hydration.
This is idempotent when already in Hydrated.
Sourcepub fn mark_runtime_ready(
&mut self,
) -> Result<bool, NextjsBootstrapTransitionError>
pub fn mark_runtime_ready( &mut self, ) -> Result<bool, NextjsBootstrapTransitionError>
Marks runtime initialization success.
This is idempotent when already in RuntimeReady.
Sourcepub fn mark_runtime_failed(
&mut self,
reason: impl Into<String>,
) -> Result<bool, NextjsBootstrapTransitionError>
pub fn mark_runtime_failed( &mut self, reason: impl Into<String>, ) -> Result<bool, NextjsBootstrapTransitionError>
Marks runtime initialization failure with a deterministic reason.
Sourcepub fn mark_runtime_cancelled(
&mut self,
reason: impl Into<String>,
) -> Result<bool, NextjsBootstrapTransitionError>
pub fn mark_runtime_cancelled( &mut self, reason: impl Into<String>, ) -> Result<bool, NextjsBootstrapTransitionError>
Marks runtime initialization cancellation with a deterministic reason.
Sourcepub fn retry_after_failure(
&mut self,
) -> Result<bool, NextjsBootstrapTransitionError>
pub fn retry_after_failure( &mut self, ) -> Result<bool, NextjsBootstrapTransitionError>
Retries bootstrap after a previous runtime failure.
Applies a navigation event to bootstrap state.
Soft navigations preserve runtime state. Hard and popstate navigations
reset to ServerRendered.
Sourcepub fn on_hot_reload(&mut self) -> Result<bool, NextjsBootstrapTransitionError>
pub fn on_hot_reload(&mut self) -> Result<bool, NextjsBootstrapTransitionError>
Applies a hot-reload event (e.g., Fast Refresh).
This forces re-hydration from active or failed runtime phases while preserving deterministic bookkeeping.
Trait Implementations§
Source§impl Clone for NextjsBootstrapState
impl Clone for NextjsBootstrapState
Source§fn clone(&self) -> NextjsBootstrapState
fn clone(&self) -> NextjsBootstrapState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more