Struct leptos::LeptosOptions
source · pub struct LeptosOptions {
pub output_name: String,
pub site_root: String,
pub site_pkg_dir: String,
pub env: Env,
pub site_addr: 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, axum, and viz 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_addr: 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§
source§impl LeptosOptions
impl LeptosOptions
sourcepub fn builder() -> LeptosOptionsBuilder<((), (), (), (), (), ())>
pub fn builder() -> LeptosOptionsBuilder<((), (), (), (), (), ())>
Create a builder for building LeptosOptions
.
On the builder, call .output_name(...)
, .site_root(...)
(optional), .site_pkg_dir(...)
(optional), .env(...)
(optional), .site_addr(...)
(optional), .reload_port(...)
(optional) to set the values of the fields.
Finally, call .build()
to create the instance of LeptosOptions
.
Trait Implementations§
source§impl Clone for LeptosOptions
impl Clone for LeptosOptions
source§fn clone(&self) -> LeptosOptions
fn clone(&self) -> LeptosOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more