Skip to main content

Page

Struct Page 

Source
pub struct Page { /* private fields */ }

Implementations§

Source§

impl Page

Source

pub fn new(name: impl Into<String>, props: impl Serialize) -> Self

Source

pub fn mode(self, mode: RenderMode) -> Self

Source

pub fn spa(self) -> Self

Source

pub fn ssr(self) -> Self

Source

pub fn islands(self) -> Self

Source

pub fn shared(self, shared: impl Serialize) -> Self

Source

pub fn errors(self, errors: impl Serialize) -> Self

Source

pub fn flash(self, flash: impl Serialize) -> Self

Source

pub fn contract_hash(self, hash: impl Into<String>) -> Self

Source

pub fn asset_version(self, version: impl Into<String>) -> Self

Source

pub fn request_id(self, request_id: impl Into<String>) -> Self

Source

pub fn head(self, head: PageHead) -> Self

Source

pub fn csrf_token(self, csrf_token: impl Into<String>) -> Self

Source

pub fn island(self, component: impl Into<String>, props: impl Serialize) -> Self

Source

pub fn island_with_id( self, id: impl Into<String>, component: impl Into<String>, props: impl Serialize, ) -> Self

Source

pub fn trusted_server_html(self, html: impl Into<String>) -> Self

Attach HTML produced by a trusted React server renderer.

Source

pub fn document(self, template: DocumentTemplate) -> Self

Customize the trusted HTML chrome around Phoenix’s managed React root.

Source

pub fn rendered(self, result: RenderResult) -> Self

Apply HTML and island descriptors returned by the trusted SSR renderer.

Source

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.

Source

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.

Source

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.

Source

pub fn script_src(self, source: impl Into<String>) -> Self

Override the browser entrypoint, for example when using a Vite dev server.

Source

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.

Source

pub const fn envelope(&self) -> &PageEnvelope

Source

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.

Source

pub fn is_page_request(headers: &HeaderMap) -> bool

Trait Implementations§

Source§

impl Clone for Page

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Page

Source§

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

Formats the value using the given formatter. Read more
Source§

impl IntoResponse for Page

Auto Trait Implementations§

§

impl !RefUnwindSafe for Page

§

impl !UnwindSafe for Page

§

impl Freeze for Page

§

impl Send for Page

§

impl Sync for Page

§

impl Unpin for Page

§

impl UnsafeUnpin for Page

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> 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> 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 = !

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