Using FromStr / Display for Route Captures #3595
athanclark
started this conversation in
Ideas
Replies: 1 comment
-
I didn't realize that this is actually already a feature (at least I'm pretty sure, I haven't tested it yet). Here is the macro generation that parses the url path part: https://github.com/CombatClassifieds/Website/pull/31/files#diff-53acca9f15efc7bfb3445c21eae75a15deeea03c4b4332990b01cc3579c56ce2 And here it prints the part using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I have a desire to use typed route matching with my yew routes, similar to how axum matches its routes. In an ideal world, I'd like the following routes to work together:
Where the macro generated would first try to parse the block as a
u8
and save it as theid
field in aRoute::Foo
, and if failing, it would try and do the same with abool
in thebar
field ofRoute::Bar
.The circumstance of overlapping parsable instances would just have to cascade:
Route::Short
after parsing would contain values greater than255
; it would be up to the user of the library to ensure that printing & parsing isomorphisms hold with the respect to the intent of their applications, and that parsing the data is mutually exclusive.Beta Was this translation helpful? Give feedback.
All reactions