pub struct RuntimeLayer;Available on crate feature
router only.Expand description
A Layer that handles runtime requests at each page’s URL.
The browser can request a render in two ways:
- Send a
POSTwithX-Topcoat-Runtime: trueand the document’s signal values as JSON. The layer rewrites this to aGETat the same path and query. The page, layouts, and guards run with the supplied signal values. The rewritten request has an empty body and noRUNTIME_HEADER,Content-Type, orContent-Lengthheaders. To read the original method, useoriginal_method. - Open a WebSocket with the
RUNTIME_PROTOCOLsubprotocol. Each render request on this connection describes an HTTP request: a method, a path, a body, and a few runtime headers, such asRUNTIME_HEADERfor a page rerun. The layer dispatches it with the handshake’s other headers as a connected render. Renders run side by side, and each message sent back names the render it belongs to. A connection may have at mostmax_runs_per_connectionrenders at once.
WebSocket connections are supported on native servers. HTTP page reruns are also available on WebAssembly.
Other requests pass through unchanged, including form submissions and WebSocket requests that do not use the runtime subprotocol.
Register this layer with
RouterBuilderRuntimeExt::runtime.
Call it after adding your application’s pathless layers so they receive
the rewritten GET.
Trait Implementations§
Source§impl Clone for RuntimeLayer
impl Clone for RuntimeLayer
impl Copy for RuntimeLayer
Source§impl Debug for RuntimeLayer
impl Debug for RuntimeLayer
Source§impl Default for RuntimeLayer
impl Default for RuntimeLayer
Source§impl Layer for RuntimeLayer
impl Layer for RuntimeLayer
Auto Trait Implementations§
impl Freeze for RuntimeLayer
impl RefUnwindSafe for RuntimeLayer
impl Send for RuntimeLayer
impl Sync for RuntimeLayer
impl Unpin for RuntimeLayer
impl UnsafeUnpin for RuntimeLayer
impl UnwindSafe for RuntimeLayer
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