In order to facilitate its usage in other structs, which might derive
various traits, such as `serde::Serialize` or `PartialEq`, implement
them for the `leptos_config::Env` enum.
Signed-off-by: Filip Dutescu <filip@hucksy.dev>
Currently, `leptos::LeptosOptions` are deserialized (and serialized)
to `snake_case`, since, by default, `serde` uses the name of the field
as-is. The options given via `.toml` files are given using `kebab-case`.
This behaviour leads to problems if you wish to use
`leptos::LeptosOptions` as the type of a field in your own config,
which uses the `kebab-case` syntax, as it will not provide any values
to that field.
These changes switch out the previous mechanism of manually replacing
the `-` character to the `_` character in order for serialization to
work. In its place, it uses `serde`'s `#[serde(rename_all = ...)]`
macro to handle the naming convention.
In case other naming conventions are used, a workaround would be to
define a user-owned mirror struct of `leptos::LeptosOptions`, which
would contain the required fields, deserialize it as desired and'
convert it to the latter via, for example, the `From<T>` trait.
Closes: #1295
Signed-off-by: Filip Dutescu <filip@hucksy.dev>
* nix-flake: use follows for `rust-overlay` (..)
This removes the extra nixpkgs dependency by re-using the nixpkgs
already defined.
https://nixos.wiki/wiki/Flakeshttps://web.archive.org/web/20230621091703/https://nixos.wiki/wiki/Flakes
> # The `follows` keyword in inputs is used for inheritance.
> # Here, `inputs.nixpkgs` of sops-nix is kept consistent with the `inputs.nixpkgs` of
> # the current flake, to avoid problems caused by different versions of nixpkgs.
* nix-flake: use nix overlays for rustc/cargo (..)
This allows the same nightly rust version to be used across the
flake (vs. strictly in the `devShell`).
* nix-flake: add `mdbook` to the development shell (..)
bumped `nixpkgs` to the latest unstable to pull in mdbook version `0.4.30`.
* nix-flake: expose all rust tools in dev environment (..)
The `oxalica / rust-overlay` docs expose all tools in the development
environment, so we should do the same:
https://github.com/oxalica/rust-overlay#use-in-devshell-for-nix-develop
---------
Co-authored-by: Jay Querie <jay@querie.cc>
This requires state to be provided via context using a special handler, but allows for extractors that use this state, rather than only `()`, as previously.