make serde optional

This commit is contained in:
Evan Almloff committed 2023-06-01 11:03:44 -05:00
1 parent fe601e2a48
commit 2f473f7c97
7 files changed
+289 -89

No files matched your search

+4 -7
View File
@@ -1,6 +1,5 @@
use dioxus::prelude::*;
use log::error;
use serde::{de::DeserializeOwned, Serialize};
use std::{cell::RefCell, str::FromStr};
use crate::{
@@ -14,7 +13,7 @@ pub struct RouterCfg<R: Routable> {
config: RefCell<Option<RouterConfiguration<R>>>,
}
impl<R: Routable + Serialize + DeserializeOwned> Default for RouterCfg<R>
impl<R: Routable> Default for RouterCfg<R>
where
<R as FromStr>::Err: std::fmt::Display,
{
@@ -35,7 +34,7 @@ impl<R: Routable> From<RouterConfiguration<R>> for RouterCfg<R> {
/// The props for [`GenericRouter`].
#[derive(Props)]
pub struct GenericRouterProps<R: Routable + Serialize + DeserializeOwned>
pub struct GenericRouterProps<R: Routable>
where
<R as FromStr>::Err: std::fmt::Display,
{
@@ -43,7 +42,7 @@ where
config: RouterCfg<R>,
}
impl<R: Routable + Serialize + DeserializeOwned> PartialEq for GenericRouterProps<R>
impl<R: Routable> PartialEq for GenericRouterProps<R>
where
<R as FromStr>::Err: std::fmt::Display,
{
@@ -54,9 +53,7 @@ where
}
/// A component that renders the current route.
pub fn GenericRouter<R: Routable + Clone + Serialize + DeserializeOwned>(
cx: Scope<GenericRouterProps<R>>,
) -> Element
pub fn GenericRouter<R: Routable + Clone>(cx: Scope<GenericRouterProps<R>>) -> Element
where
<R as FromStr>::Err: std::fmt::Display,
{