mirror of
https://github.com/DioxusLabs/dioxus
synced 2025-02-17 06:08:26 +00:00
Add Newtype so that Rust-url can be IntoRoutable (#1579)
* add newtype so that rust-url can IntoRoutable * add doc line * implement From<Url> directly --------- Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
This commit is contained in:
parent
647815fa6f
commit
b25fada776
1 changed files with 14 additions and 0 deletions
|
@ -11,6 +11,8 @@ use crate::navigation::NavigationTarget;
|
|||
use crate::prelude::Routable;
|
||||
use crate::utils::use_router_internal::use_router_internal;
|
||||
|
||||
use url::Url;
|
||||
|
||||
/// Something that can be converted into a [`NavigationTarget`].
|
||||
#[derive(Clone)]
|
||||
pub enum IntoRoutable {
|
||||
|
@ -53,6 +55,18 @@ impl From<&str> for IntoRoutable {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<Url> for IntoRoutable {
|
||||
fn from(url: Url) -> Self {
|
||||
IntoRoutable::FromStr(url.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&Url> for IntoRoutable {
|
||||
fn from(url: &Url) -> Self {
|
||||
IntoRoutable::FromStr(url.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
/// The properties for a [`Link`].
|
||||
#[derive(Props)]
|
||||
pub struct LinkProps<'a> {
|
||||
|
|
Loading…
Add table
Reference in a new issue