fix external router examples

This commit is contained in:
Evan Almloff committed 2023-06-01 14:10:33 -05:00
1 parent 45a004bf74
commit 07446386e6
7 files changed
+157 -133

No files matched your search

+4 -6
View File
@@ -5,13 +5,13 @@ use std::{cell::RefCell, str::FromStr};
use crate::{
prelude::{GenericOutlet, GenericRouterContext},
routable::Routable,
router_cfg::RouterConfiguration,
router_cfg::RouterConfig,
};
/// The config for [`GenericRouter`].
pub struct RouterConfigFactory<R: Routable> {
#[allow(clippy::type_complexity)]
config: RefCell<Option<Box<dyn FnOnce() -> RouterConfiguration<R>>>>,
config: RefCell<Option<Box<dyn FnOnce() -> RouterConfig<R>>>>,
}
impl<R: Routable> Default for RouterConfigFactory<R>
@@ -19,13 +19,11 @@ where
<R as FromStr>::Err: std::fmt::Display,
{
fn default() -> Self {
Self::from(RouterConfiguration::default)
Self::from(RouterConfig::default)
}
}
impl<R: Routable, F: FnOnce() -> RouterConfiguration<R> + 'static> From<F>
for RouterConfigFactory<R>
{
impl<R: Routable, F: FnOnce() -> RouterConfig<R> + 'static> From<F> for RouterConfigFactory<R> {
fn from(value: F) -> Self {
Self {
config: RefCell::new(Some(Box::new(value))),