-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
47 changed files
with
185 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...avex_cli/tests/ui_tests/blueprint/common/async_callable_are_supported/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
libs/pavex_cli/tests/ui_tests/blueprint/common/components_can_fail/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...nstructors/output_type_of_constructors_can_contain_generic_parameters/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...i_tests/blueprint/constructors/static_references_are_valid_singletons/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...print/constructors/the_latest_registered_constructor_takes_precedence/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...constructor_can_be_registered_multiple_times_using_the_same_lifecycle/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...g/application_state_should_include_runtime_singletons_from_all_scopes/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...s/ui_tests/blueprint/nesting/multiple_levels_of_nesting_are_supported/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
libs/pavex_cli/tests/ui_tests/blueprint/router/fallback_priority/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...avex_cli/tests/ui_tests/blueprint/router/http_method_routing_variants/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...consume_a_non_cloneable_type_from_two_different_control_flow_branches/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...ui_tests/borrow_checker/diamond/diamond_can_be_solved_if_type_is_copy/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...ui_tests/borrow_checker/diamond/diamond_can_be_solved_if_we_can_clone/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...ecker/multiple_consumers/a_clonable_framework_type_can_be_moved_twice/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...w_checker/multiple_consumers/a_clonable_input_type_can_be_moved_twice/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
.../borrow_checker/multiple_consumers/a_clonable_type_can_be_moved_twice/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...ests/borrow_checker/multiple_consumers/a_copy_type_can_be_moved_twice/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...checker/triangle/triangle_can_be_solved_if_framework_type_is_clonable/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...row_checker/triangle/triangle_can_be_solved_if_input_type_is_clonable/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...ts/borrow_checker/triangle/triangle_can_be_solved_if_type_is_clonable/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
..._tests/borrow_checker/triangle/triangle_can_be_solved_if_type_is_copy/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...ts/dependency_injection/references_to_constructible_types_are_allowed/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
libs/pavex_cli/tests/ui_tests/middlewares/next_handles_lifetimes/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
libs/pavex_cli/tests/ui_tests/reflection/arc_singletons_are_supported/expectations/app.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
//! Do NOT edit this code. | ||
//! It was automatically generated by Pavex. | ||
//! All manual edits will be lost next time the code is generated. | ||
extern crate alloc; | ||
struct ServerState { | ||
router: matchit::Router<u32>, | ||
application_state: ApplicationState, | ||
} | ||
pub struct ApplicationState { | ||
s0: alloc::sync::Arc<app::Custom>, | ||
} | ||
pub async fn build_application_state() -> crate::ApplicationState { | ||
let v0 = app::constructor(); | ||
crate::ApplicationState { s0: v0 } | ||
} | ||
pub fn run( | ||
server_builder: pavex::server::Server, | ||
application_state: ApplicationState, | ||
) -> pavex::server::ServerHandle { | ||
let server_state = std::sync::Arc::new(ServerState { | ||
router: build_router(), | ||
application_state, | ||
}); | ||
server_builder.serve(route_request, server_state) | ||
} | ||
fn build_router() -> matchit::Router<u32> { | ||
let mut router = matchit::Router::new(); | ||
router.insert("/", 0u32).unwrap(); | ||
router | ||
} | ||
async fn route_request( | ||
request: http::Request<hyper::body::Incoming>, | ||
server_state: std::sync::Arc<ServerState>, | ||
) -> pavex::response::Response { | ||
let (request_head, request_body) = request.into_parts(); | ||
#[allow(unused)] | ||
let request_body = pavex::request::body::RawIncomingBody::from(request_body); | ||
let request_head: pavex::request::RequestHead = request_head.into(); | ||
let matched_route = match server_state.router.at(&request_head.uri.path()) { | ||
Ok(m) => m, | ||
Err(_) => { | ||
let allowed_methods: pavex::router::AllowedMethods = pavex::router::MethodAllowList::from_iter( | ||
vec![], | ||
) | ||
.into(); | ||
return route_1::handler(&allowed_methods).await; | ||
} | ||
}; | ||
let route_id = matched_route.value; | ||
#[allow(unused)] | ||
let url_params: pavex::request::route::RawRouteParams<'_, '_> = matched_route | ||
.params | ||
.into(); | ||
match route_id { | ||
0u32 => { | ||
match &request_head.method { | ||
&pavex::http::Method::GET => { | ||
route_0::handler(server_state.application_state.s0.clone()).await | ||
} | ||
_ => { | ||
let allowed_methods: pavex::router::AllowedMethods = pavex::router::MethodAllowList::from_iter([ | ||
pavex::http::Method::GET, | ||
]) | ||
.into(); | ||
route_1::handler(&allowed_methods).await | ||
} | ||
} | ||
} | ||
i => unreachable!("Unknown route id: {}", i), | ||
} | ||
} | ||
pub mod route_0 { | ||
pub async fn handler( | ||
v0: alloc::sync::Arc<app::Custom>, | ||
) -> pavex::response::Response { | ||
let v1 = app::handler(v0); | ||
<http::StatusCode as pavex::response::IntoResponse>::into_response(v1) | ||
} | ||
} | ||
pub mod route_1 { | ||
pub async fn handler( | ||
v0: &pavex::router::AllowedMethods, | ||
) -> pavex::response::Response { | ||
let v1 = pavex::router::default_fallback(v0).await; | ||
<pavex::response::Response as pavex::response::IntoResponse>::into_response(v1) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...x_cli/tests/ui_tests/reflection/arc_singletons_are_supported/expectations/diagnostics.dot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
digraph "GET / - 0" { | ||
0 [ label = "app::handler(alloc::sync::Arc<app::Custom>) -> http::StatusCode"] | ||
1 [ label = "alloc::sync::Arc<app::Custom>"] | ||
2 [ label = "<http::StatusCode as pavex::response::IntoResponse>::into_response(http::StatusCode) -> pavex::response::Response"] | ||
1 -> 0 [ ] | ||
0 -> 2 [ ] | ||
} | ||
|
||
digraph "* / - 0" { | ||
0 [ label = "pavex::router::default_fallback(&pavex::router::AllowedMethods) -> pavex::response::Response"] | ||
2 [ label = "<pavex::response::Response as pavex::response::IntoResponse>::into_response(pavex::response::Response) -> pavex::response::Response"] | ||
3 [ label = "&pavex::router::AllowedMethods"] | ||
0 -> 2 [ ] | ||
3 -> 0 [ ] | ||
} | ||
|
||
digraph app_state { | ||
0 [ label = "crate::ApplicationState(alloc::sync::Arc<app::Custom>) -> crate::ApplicationState"] | ||
1 [ label = "app::constructor() -> alloc::sync::Arc<app::Custom>"] | ||
1 -> 0 [ ] | ||
} |
Oops, something went wrong.