pub struct Page { /* private fields */ }Implementations§
Source§impl Page
impl Page
pub fn new(name: impl Into<String>, props: impl Serialize) -> Self
pub fn mode(self, mode: RenderMode) -> Self
pub fn spa(self) -> Self
pub fn ssr(self) -> Self
pub fn islands(self) -> Self
pub fn errors(self, errors: impl Serialize) -> Self
pub fn flash(self, flash: impl Serialize) -> Self
pub fn contract_hash(self, hash: impl Into<String>) -> Self
pub fn asset_version(self, version: impl Into<String>) -> Self
pub fn request_id(self, request_id: impl Into<String>) -> Self
pub fn head(self, head: PageHead) -> Self
pub fn csrf_token(self, csrf_token: impl Into<String>) -> Self
pub fn island(self, component: impl Into<String>, props: impl Serialize) -> Self
pub fn island_with_id( self, id: impl Into<String>, component: impl Into<String>, props: impl Serialize, ) -> Self
Sourcepub fn trusted_server_html(self, html: impl Into<String>) -> Self
pub fn trusted_server_html(self, html: impl Into<String>) -> Self
Attach HTML produced by a trusted React server renderer.
Sourcepub fn document(self, template: DocumentTemplate) -> Self
pub fn document(self, template: DocumentTemplate) -> Self
Customize the trusted HTML chrome around Phoenix’s managed React root.
Sourcepub fn rendered(self, result: RenderResult) -> Self
pub fn rendered(self, result: RenderResult) -> Self
Apply HTML and island descriptors returned by the trusted SSR renderer.
Sourcepub fn production_assets(
self,
manifest: &AssetManifest,
entry_name: &str,
) -> Result<Self, AssetManifestError>
pub fn production_assets( self, manifest: &AssetManifest, entry_name: &str, ) -> Result<Self, AssetManifestError>
Apply one entry from a validated production asset manifest.
§Errors
Returns an error when the entry is missing or references an undeclared asset.
Sourcepub async fn respond_with_renderer(
self,
request: &Request,
renderer: &NodeRenderer,
) -> Response
pub async fn respond_with_renderer( self, request: &Request, renderer: &NodeRenderer, ) -> Response
Render an SSR or Islands page and select the document or page-protocol response.
Sourcepub fn respond_streaming_with_renderer(
self,
request: &Request,
renderer: &NodeRenderer,
) -> Response
pub fn respond_streaming_with_renderer( self, request: &Request, renderer: &NodeRenderer, ) -> Response
Stream an SSR/Islands document as renderer chunks arrive. Page-protocol navigation requests still return the normal atomic JSON envelope.
Sourcepub fn script_src(self, source: impl Into<String>) -> Self
pub fn script_src(self, source: impl Into<String>) -> Self
Override the browser entrypoint, for example when using a Vite dev server.
Sourcepub fn respond_to(
self,
request: &Request,
codec: Option<&dyn PayloadCodec>,
) -> Result<Response, PageResponseError>
pub fn respond_to( self, request: &Request, codec: Option<&dyn PayloadCodec>, ) -> Result<Response, PageResponseError>
Select a document or protocol response from the incoming request.
§Errors
Returns an error if serialization or the selected codec fails.
pub const fn envelope(&self) -> &PageEnvelope
Sourcepub fn respond(
self,
page_request: bool,
codec: Option<&dyn PayloadCodec>,
) -> Result<Response, PageResponseError>
pub fn respond( self, page_request: bool, codec: Option<&dyn PayloadCodec>, ) -> Result<Response, PageResponseError>
Return either a document response or a page-protocol response.
Set X-Phoenix-Page: 1 on client navigation requests. A codec encrypts
only those protocol responses; initial HTML always contains readable
hydration data because the browser must render it.
§Errors
Returns an error if serialization or the selected codec fails.