Skip to content

Commit 6fee4d0

Browse files
fix(shield): correctly dereference Box<dyn Any> to &dyn Any (#130)
1 parent 1916ce5 commit 6fee4d0

5 files changed

Lines changed: 18 additions & 15 deletions

File tree

examples/dioxus-axum/src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use crate::app::App;
55

66
#[cfg(not(feature = "server"))]
77
fn main() {
8-
use shield_bootstrap::dioxus::BootstrapStyle;
8+
use shield_bootstrap::BootstrapDioxusStyle;
99

1010
dioxus::LaunchBuilder::new()
11-
.with_context(BootstrapStyle::default().context())
11+
.with_context(BootstrapDioxusStyle::default().context())
1212
.launch(App)
1313
}
1414

@@ -23,8 +23,8 @@ async fn main() {
2323
prelude::{DioxusRouterExt, *},
2424
};
2525
use shield::{Shield, ShieldOptions};
26-
use shield_bootstrap::dioxus::BootstrapStyle;
27-
use shield_dioxus_axum::{DioxusAxumIntegration, ShieldLayer};
26+
use shield_bootstrap::BootstrapDioxusStyle;
27+
use shield_dioxus_axum::{AxumDioxusIntegration, ShieldLayer};
2828
use shield_memory::{MemoryStorage, User};
2929
use shield_oidc::{Keycloak, OidcMethod};
3030
use tokio::net::TcpListener;
@@ -66,8 +66,8 @@ async fn main() {
6666
let router = Router::new()
6767
.serve_dioxus_application(
6868
ServeConfigBuilder::new()
69-
.context(DioxusAxumIntegration::<User>::default().context())
70-
.context(BootstrapStyle::default().context())
69+
.context(AxumDioxusIntegration::<User>::default().context())
70+
.context(BootstrapDioxusStyle::default().context())
7171
.build()
7272
.unwrap(),
7373
App,

packages/core/shield/src/shield.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl<U: User> Shield<U> {
7777
};
7878

7979
for provider in method.erased_providers().await? {
80-
if !action.erased_condition(&provider, session.clone())? {
80+
if !action.erased_condition(&*provider, session.clone())? {
8181
continue;
8282
}
8383

packages/integrations/shield-dioxus-axum/src/integration.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ use shield::{Session, ShieldDyn, User};
77
use shield_axum::{ExtractSession, ExtractShield};
88
use shield_dioxus::{DioxusIntegration, DioxusIntegrationDyn};
99

10-
pub struct DioxusAxumIntegration<U: User>(PhantomData<U>);
10+
pub struct AxumDioxusIntegration<U: User>(PhantomData<U>);
1111

12-
impl<U: User + Clone + 'static> DioxusAxumIntegration<U> {
12+
impl<U: User + Clone + 'static> AxumDioxusIntegration<U> {
1313
pub fn context(self) -> DioxusIntegrationDyn {
1414
DioxusIntegrationDyn::new(self)
1515
}
1616
}
1717

18-
impl<U: User> Default for DioxusAxumIntegration<U> {
18+
impl<U: User> Default for AxumDioxusIntegration<U> {
1919
fn default() -> Self {
2020
Self(Default::default())
2121
}
2222
}
2323

2424
#[async_trait]
25-
impl<U: User + Clone + 'static> DioxusIntegration for DioxusAxumIntegration<U> {
25+
impl<U: User + Clone + 'static> DioxusIntegration for AxumDioxusIntegration<U> {
2626
async fn extract_shield(&self) -> ShieldDyn {
2727
let ExtractShield(shield) = extract::<ExtractShield<U>, _>().await.expect("TODO");
2828

packages/styles/shield-bootstrap/src/dioxus.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ use shield::Form;
33
use shield_dioxus::{DioxusStyle, ErasedDioxusStyle};
44

55
#[derive(Default)]
6-
pub struct BootstrapStyle {}
6+
pub struct BootstrapDioxusStyle {}
77

8-
impl BootstrapStyle {
8+
impl BootstrapDioxusStyle {
99
pub fn context(self) -> ErasedDioxusStyle {
1010
ErasedDioxusStyle::new(self)
1111
}
1212
}
1313

14-
impl DioxusStyle for BootstrapStyle {
14+
impl DioxusStyle for BootstrapDioxusStyle {
1515
fn render(&self, forms: &[Form]) -> Element {
1616
rsx! {
1717
div {
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
#[cfg(feature = "dioxus")]
2-
pub mod dioxus;
2+
mod dioxus;
3+
4+
#[cfg(feature = "dioxus")]
5+
pub use dioxus::*;

0 commit comments

Comments
 (0)