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

source

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

source§

fn clone(&self) -> LeptosOptions

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for LeptosOptions

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for LeptosOptions

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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, U> Into<U> for Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,