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

add route type enum #299

Merged
merged 4 commits into from
Nov 7, 2022
Merged

add route type enum #299

merged 4 commits into from
Nov 7, 2022

Conversation

suhailmalik07
Copy link
Contributor

Description

This PR fixes #254

I'm working on this.

@sansyrox It will be great, If you can point me to the places from where you think code can be converted to enum and types?

@netlify
Copy link

netlify bot commented Oct 28, 2022

Deploy Preview for robyn canceled.

Name Link
🔨 Latest commit 299b1e2
🔍 Latest deploy log https://app.netlify.com/sites/robyn/deploys/635f671ee58e59000893905a

@@ -9,6 +9,8 @@ use matchit::Node;

use anyhow::{bail, Error, Result};

use super::router::RouteType;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think super is required anymore in Rust.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another option is to write like this.

use crate::routers::types::MiddlewareRouteType;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@suhailmalik07 , yep. That is the preferred way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update with this.

src/routers/router.rs Outdated Show resolved Hide resolved
Copy link
Member

@sansyrox sansyrox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @suhailmalik07 . 👋

Thank you for the PR. 😄

I have a few inline comments.

fn get_relevant_map(&self, route: &str) -> Option<&RwLock<Node<(PyFunction, u8)>>> {
fn get_relevant_map(
&self,
route: MiddlewareRouteType,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one last nit: MiddlewareRoute would make more sense than MiddlewareRouteType.

Reason:

If you ask the type of route then it should be MiddlewareRoute and not type = MiddlewareRouteType.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, updated this also.

Copy link
Member

@sansyrox sansyrox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again @suhailmalik07 for the quick updates. I just have two final suggestions before we can merge this PR 😄

@suhailmalik07 suhailmalik07 marked this pull request as ready for review October 30, 2022 07:15
sansyrox
sansyrox previously approved these changes Oct 30, 2022
Copy link
Member

@sansyrox sansyrox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great work!

@sansyrox sansyrox dismissed their stale review October 30, 2022 18:38

conflicting files

@sansyrox
Copy link
Member

@suhailmalik07 , there are some conflicting files. Can you please rebase the latest changes?

@suhailmalik07
Copy link
Contributor Author

@suhailmalik07 , there are some conflicting files. Can you please rebase the latest changes?

Rebased 🙂

Copy link
Member

@sansyrox sansyrox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀 🟢

@sansyrox sansyrox merged commit 04a53fc into sparckles:main Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Refactor Code to include better types
2 participants