pub struct SsrSharedContext { /* private fields */ }Expand description
The shared context that should be used on the server side.
Implementations§
Sourcepub fn new_islands() -> Self
pub fn new_islands() -> Self
Creates a new shared context for rendering HTML on the server in “islands” mode.
This defaults to a mode in which the app is not hydrated, but allows you to opt into
hydration for certain portions using SharedContext::set_is_hydrating.
Sourcepub async fn consume_buffers(&self) -> Vec<(SerializedDataId, String)>
pub async fn consume_buffers(&self) -> Vec<(SerializedDataId, String)>
Consume the data buffers, awaiting all async resources, returning both sync and async buffers. Useful to implement custom hydration contexts.
WARNING: this will clear the internal buffers, it should only be called once.
A second call would return an empty vec![].
Trait Implementations§
Source§fn default() -> SsrSharedContext
fn default() -> SsrSharedContext
Returns the “default value” for a type. Read more
Source§fn is_browser(&self) -> bool
fn is_browser(&self) -> bool
Whether the application is running in the browser.
Source§fn next_id(&self) -> SerializedDataId
fn next_id(&self) -> SerializedDataId
Returns the next in a series of IDs that is unique to a particular request and response. Read more
Source§fn write_async(&self, id: SerializedDataId, fut: PinnedFuture<String>)
fn write_async(&self, id: SerializedDataId, fut: PinnedFuture<String>)
Source§fn read_data(&self, _id: &SerializedDataId) -> Option<String>
fn read_data(&self, _id: &SerializedDataId) -> Option<String>
Reads the current value of some data from the shared context, if it has been
sent from the server. This returns the serialized data as a
String that should
be deserialized. Read moreSource§fn await_data(&self, _id: &SerializedDataId) -> Option<String>
fn await_data(&self, _id: &SerializedDataId) -> Option<String>
Source§fn get_is_hydrating(&self) -> bool
fn get_is_hydrating(&self) -> bool
Returns
true if you are currently in a part of the application tree that should be
hydrated. Read moreSource§fn set_is_hydrating(&self, is_hydrating: bool)
fn set_is_hydrating(&self, is_hydrating: bool)
Sets whether you are currently in a part of the application tree that should be hydrated. Read more
Source§fn errors(&self, boundary_id: &SerializedDataId) -> Vec<(ErrorId, Error)>
fn errors(&self, boundary_id: &SerializedDataId) -> Vec<(ErrorId, Error)>
Returns the set of errors that have been registered with a particular boundary.
Source§fn register_error(
&self,
error_boundary_id: SerializedDataId,
error_id: ErrorId,
error: Error,
)
fn register_error( &self, error_boundary_id: SerializedDataId, error_id: ErrorId, error: Error, )
Registers an error with the context to be shared from server to client.
Source§fn take_errors(&self) -> Vec<(SerializedDataId, ErrorId, Error)>
fn take_errors(&self) -> Vec<(SerializedDataId, ErrorId, Error)>
Returns all errors that have been registered, removing them from the list.
Source§fn seal_errors(&self, boundary_id: &SerializedDataId)
fn seal_errors(&self, boundary_id: &SerializedDataId)
“Seals” an error boundary, preventing further errors from being registered for it. Read more
Source§fn pending_data(&self) -> Option<PinnedStream<String>>
fn pending_data(&self) -> Option<PinnedStream<String>>
Source§fn during_hydration(&self) -> bool
fn during_hydration(&self) -> bool
Whether the page is currently being hydrated. Read more
Source§fn hydration_complete(&self)
fn hydration_complete(&self)
Tells the shared context that the hydration process is complete.
Source§fn defer_stream(&self, wait_for: PinnedFuture<()>)
fn defer_stream(&self, wait_for: PinnedFuture<()>)
Adds a
Future to the set of “blocking resources” that should prevent the server’s
response stream from beginning until all are resolved. The Future returned by
blocking resources will not resolve until every Future added by this method
has resolved. Read moreSource§fn await_deferred(&self) -> Option<PinnedFuture<()>>
fn await_deferred(&self) -> Option<PinnedFuture<()>>
Source§fn set_incomplete_chunk(&self, id: SerializedDataId)
fn set_incomplete_chunk(&self, id: SerializedDataId)
Tells the client that this chunk is being sent from the server before all its data have
loaded, and it may be in a fallback state.
Source§fn get_incomplete_chunk(&self, id: &SerializedDataId) -> bool
fn get_incomplete_chunk(&self, id: &SerializedDataId) -> bool
Checks whether this chunk is being sent from the server before all its data have loaded.
Auto Trait Implementations§
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