Add query segment example and documentation (#1417)

* fix a few new clippy lints

* Add query segment example

* Add trait documentation

* Change core package to root package

The core package contains the virtual dom implementation ([here](https://github.com/DioxusLabs/dioxus/tree/master/packages/core)). Root package might be a more clear way to refer to the main directory

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
This commit is contained in:
StygmatesandEvan Almloff authored and GitHub committed 2023-09-02 10:24:30 -05:00
1 parent 4511b37da8
commit 1b977fdce9
6 files changed
+108 -19

No files matched your search

+5 -1
View File
@@ -22,7 +22,11 @@ impl<E: std::fmt::Display> std::fmt::Display for RouteParseError<E> {
}
}
/// Something that can be created from a query string
/// Something that can be created from a query string.
///
/// This trait needs to be implemented if you want to turn a query string into a struct.
///
/// A working example can be found in the `examples` folder in the root package under `query_segments_demo`
pub trait FromQuery {
/// Create an instance of `Self` from a query string
fn from_query(query: &str) -> Self;