pub struct MountConfigBuilder {
pub mount_point: String,
pub dest_dir: String,
pub env: Vec<(String, String)>,
pub wasm_preload: bool,
pub disable_hydration: bool,
pub ssr_fetch_base: Option<String>,
pub ssr_cookies: Vec<String>,
pub ssr_fetch_cookies: Vec<String>,
pub pretty_html: bool,
pub precompress: bool,
}Fields§
§mount_point: String§dest_dir: String§env: Vec<(String, String)>§wasm_preload: bool§disable_hydration: bool§ssr_fetch_base: Option<String>§pretty_html: bool§precompress: boolImplementations§
Source§impl MountConfigBuilder
impl MountConfigBuilder
pub fn new( mount_point: impl Into<String>, dest_dir: impl Into<String>, ) -> MountConfigBuilder
pub fn envs(self, envs: Vec<(String, String)>) -> Self
pub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn wasm_preload(self, wasm_preload: bool) -> Self
pub fn disable_hydration(self, disable_hydration: bool) -> Self
Sourcepub fn ssr_fetch_base(self, origin: impl Into<String>) -> Self
pub fn ssr_fetch_base(self, origin: impl Into<String>) -> Self
Origin against which SSR resolves relative fetch URLs (/api/posts), e.g. http://127.0.0.1:8080.
Without it, fetching a relative URL during SSR fails.
A cookie the app may read with get_driver().cookie_get() while the server renders the
page, f. ex. the language the user picked, so the page comes rendered as the browser will
show it. Others read as empty there, as they always did.
Only for a cookie the browser shows the app too: not HttpOnly. The Cookie header doesn’t
tell which are, and the server would render what the browser can’t.
A cookie that goes out with the fetches to the server’s own origin while it renders the
page, f. ex. the session, HttpOnly or not. Once any is named the others stay behind, and
a visitor with only those (the analytics’, say) is rendered as a guest, which a cache on
the way may keep. With none named, all of them go.
In the browser, a LazyCache takes what the server fetched at its
word until its TTL runs out, also when the server fetched it as for a guest. So data that
depends on who asks has to be fetched here with the right cookie, or left alone during
SSR: render f. ex. a spinner when get_driver().is_server().
Sourcepub fn pretty_html(self, pretty_html: bool) -> Self
pub fn pretty_html(self, pretty_html: bool) -> Self
Indent the server-rendered HTML, to read it in the page source.
Off by default: the indentation is whitespace between elements, which the app’s own tree doesn’t have - until the app starts it shows as gaps between inline elements, and hydration then takes it out, one node at a time.
Sourcepub fn precompress(self, precompress: bool) -> Self
pub fn precompress(self, precompress: bool) -> Self
Compress the build’s wasm, wasm_run.js and other text files with brotli at its highest
level once, in ServerState::init, and serve those to
the browsers that accept brotli - vertigo_install and
vertigo_files do.
They come out about a quarter smaller than compressed per response, for about a second
of startup per megabyte - in a release build of the server, in a debug one far more,
see precompress_in_release. The files vertigo build
saved compressed next to them (name.ext.br, unless built with --precompress false)
take no time: the server only checks that they unpack to the files, so one copied with
the build but stale doesn’t get served.
Sourcepub fn precompress_in_release(self) -> Self
pub fn precompress_in_release(self) -> Self
precompress in a release build of the server, none in a debug one:
brotli built without optimizations, on a debug build of the app’s wasm (tens of megabytes),
takes minutes before the server starts.
A build counts as release when it has no debug assertions, as cargo build --release by
default.
pub fn build(self) -> Result<MountConfig, ErrorCode>
Auto Trait Implementations§
impl Forget for MountConfigBuilder
impl Freeze for MountConfigBuilder
impl Move for MountConfigBuilder
impl RefUnwindSafe for MountConfigBuilder
impl Send for MountConfigBuilder
impl Sync for MountConfigBuilder
impl Unpin for MountConfigBuilder
impl UnsafeUnpin for MountConfigBuilder
impl UnwindSafe for MountConfigBuilder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more