{"id":17053066,"url":"https://github.com/bschwind/app-route","last_synced_at":"2025-10-24T17:13:15.849Z","repository":{"id":57491642,"uuid":"183600367","full_name":"bschwind/app-route","owner":"bschwind","description":"Treat application routes (URL path + query string) as strongly-typed Rust structs","archived":false,"fork":false,"pushed_at":"2019-06-16T03:38:45.000Z","size":21,"stargazers_count":13,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-31T13:50:49.543Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bschwind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-26T09:30:53.000Z","updated_at":"2020-06-24T21:02:13.000Z","dependencies_parsed_at":"2022-08-31T01:50:52.370Z","dependency_job_id":null,"html_url":"https://github.com/bschwind/app-route","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bschwind%2Fapp-route","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bschwind%2Fapp-route/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bschwind%2Fapp-route/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bschwind%2Fapp-route/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bschwind","download_url":"https://codeload.github.com/bschwind/app-route/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223527836,"owners_count":17160091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T10:11:15.592Z","updated_at":"2025-10-24T17:13:10.804Z","avatar_url":"https://github.com/bschwind.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"AppRoute\n=======\n\nTreat application routes (URL path + query string) as strongly-typed Rust structs\n\nDependencies\n------------\n- cargo\n- rustc\n\nBuild\n-----\n    $ cargo build\n\nTest\n-----------\n    $ cargo test\n\nBenchmark\n-----------\n    $ cargo bench\n\nExample Code\n------------\n`src/Cargo.toml`\n```toml\n[dependencies]\napp_route = \"0.1\"\nserde = { version = \"1.0\", features = [\"derive\"] }\n```\n\n`main.rs`\n```rust\nuse app_route::AppRoute;\nuse serde::{Deserialize, Serialize};\n\n#[derive(Debug, Serialize, Deserialize, PartialEq)]\nstruct UserListQuery {\n    limit: Option\u003cu64\u003e,\n    offset: Option\u003cu64\u003e,\n    keyword: Option\u003cString\u003e,\n\n    #[serde(default)]\n    friends_only: bool,\n}\n\n#[derive(AppRoute, Debug, PartialEq)]\n#[route(\"/groups/:group_id/users\")]\nstruct UsersListRoute {\n    group_id: u64,\n\n    #[query]\n    query: UserListQuery,\n}\n\nfn main() {\n    let path: UsersListRoute =\n        \"/groups/4313145/users?offset=10\u0026limit=20\u0026friends_only=false\u0026keyword=some_keyword\"\n            .parse()\n            .unwrap();\n\n    assert_eq!(\n        path,\n        UsersListRoute {\n            group_id: 4313145,\n            query: {\n                UserListQuery {\n                    limit: Some(20),\n                    offset: Some(10),\n                    keyword: Some(\"some_keyword\".to_string()),\n                    friends_only: false,\n                }\n            }\n        }\n    );\n\n    println!(\"Path: {}\", path);\n    // Output:\n    // Path: /groups/4313145/users?limit=20\u0026offset=10\u0026keyword=some_keyword\u0026friends_only=false\n}\n\n```\n\nTODO\n----\n\n- [ ] URL Hash Fragments\n- [x] Support trailing wildcard as a path param\n- [ ] Make the AppRoute trait object-safe if possible\n- [ ] Use spans properly in the procedural macro so errors actually make sense\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbschwind%2Fapp-route","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbschwind%2Fapp-route","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbschwind%2Fapp-route/lists"}