Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(breaking): allow make PossibleRouteMatch dyn-safe #3421

Merged
merged 3 commits into from
Jan 17, 2025

Conversation

gbj
Copy link
Collaborator

@gbj gbj commented Dec 29, 2024

This allows a pattern like this:

enum Page {
    Home { f1: u8 },
    Account(u8),
}

impl Page {
    fn to_route(&self) -> Arc<dyn PossibleRouteMatch + Send + Sync> {
        match self {
            Self::Home { f1 } => {
                Arc::new((StaticSegment("home"), ParamSegment("f1")))
            }
            Self::Account(acc) => {
                Arc::new((StaticSegment("accounts"), ParamSegment("f1")))
            }
        }
    }
}

@gbj gbj added the breaking label Dec 29, 2024
@thestarmaker
Copy link
Contributor

is this a temporary fix and something bigger comming soon or should this be tagged with 0.8?

@gbj
Copy link
Collaborator Author

gbj commented Jan 11, 2025

Not sure I understand your question @thestarmaker. It is a useful API to have, and a useful change to make, but requires breaking changes (hence the tag) so won't be merged until it's time for 0.8.

@thestarmaker
Copy link
Contributor

no worries, I was looking through https://github.com/leptos-rs/leptos/milestone/6 and this is not listed there, so thought I better ask; but yeah, you've just confirmed it's happening

@gbj gbj added this to the 0.8 milestone Jan 11, 2025
@gbj
Copy link
Collaborator Author

gbj commented Jan 11, 2025

Oh, got it. I don't use milestones particularly systematically... I'll tag this one and a couple others while I'm at it :-)

@gbj gbj changed the base branch from main to leptos_0.8 January 17, 2025 18:32
@gbj gbj merged commit d1513a4 into leptos_0.8 Jan 17, 2025
74 checks passed
@gbj gbj deleted the dyn-safe-route-matching branch January 17, 2025 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants