Skip to main content

MountConfigBuilder

Struct MountConfigBuilder 

Source
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 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>§ssr_cookies: Vec<String>§pretty_html: bool§precompress: bool

Implementations§

Source§

impl MountConfigBuilder

Source

pub fn new( mount_point: impl Into<String>, dest_dir: impl Into<String>, ) -> MountConfigBuilder

Source

pub fn envs(self, envs: Vec<(String, String)>) -> Self

Source

pub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self

Source

pub fn wasm_preload(self, wasm_preload: bool) -> Self

Source

pub fn disable_hydration(self, disable_hydration: bool) -> Self

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn build(self) -> Result<MountConfig, ErrorCode>

Auto Trait Implementations§

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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