pub struct LeptosOptions {
    pub output_name: String,
    pub site_root: String,
    pub site_pkg_dir: String,
    pub env: Env,
    pub site_address: SocketAddr,
    pub reload_port: u32,
}
Expand description

This struct serves as a convenient place to store details used for configuring Leptos. It’s used in our actix and axum integrations to generate the correct path for WASM, JS, and Websockets, as well as other configuration tasks. It shares keys with cargo-leptos, to allow for easy interoperability

Fields§

§output_name: String

The name of the WASM and JS files generated by wasm-bindgen. Defaults to the crate name with underscores instead of dashes

§site_root: String

The path of the all the files generated by cargo-leptos. This defaults to ‘.’ for convenience when integrating with other tools.

§site_pkg_dir: String

The path of the WASM and JS files generated by wasm-bindgen from the root of your app By default, wasm-bindgen puts them in pkg.

§env: Env

Used to configure the running environment of Leptos. Can be used to load dev constants and keys v prod, or change things based on the deployment environment I recommend passing in the result of env::var("LEPTOS_ENV")

§site_address: SocketAddr

Provides a way to control the address leptos is served from. Using an env variable here would allow you to run the same code in dev and prod Defaults to 127.0.0.1:3000

§reload_port: u32

The port the Websocket watcher listens on. Should match the reload_port in cargo-leptos(if using). Defaults to 3001

Implementations§

Create a builder for building LeptosOptions. On the builder, call .output_name(...), .site_root(...)(optional), .site_pkg_dir(...)(optional), .env(...)(optional), .site_address(...)(optional), .reload_port(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of LeptosOptions.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.