Page MenuHomeDevCentral

D3723.diff
No OneTemporary

D3723.diff

diff --git a/axum/Cargo.toml b/axum/Cargo.toml
--- a/axum/Cargo.toml
+++ b/axum/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "limiting-factor-axum"
-version = "0.1.0"
+version = "0.2.0"
authors = [
"Sébastien Santoro <dereckson@espace-win.org>",
]
diff --git a/axum/src/api/replies.rs b/axum/src/api/replies.rs
--- a/axum/src/api/replies.rs
+++ b/axum/src/api/replies.rs
@@ -50,6 +50,16 @@
fn response(&self) -> String;
}
+impl FailureResponse for StatusCode {
+ fn status_code(&self) -> StatusCode {
+ self.clone()
+ }
+
+ fn response(&self) -> String {
+ self.canonical_reason().unwrap_or_default().to_string()
+ }
+}
+
impl<T, E> ApiResponse<T> for Result<T, E>
where T: ApiResponse<T>, E: FailureResponse
{
diff --git a/axum/src/app.rs b/axum/src/app.rs
--- a/axum/src/app.rs
+++ b/axum/src/app.rs
@@ -55,6 +55,13 @@
self
}
+ pub fn from_router(router: Router) -> Self {
+ Self {
+ config: ServerConfig::from_env(),
+ router,
+ }
+ }
+
fn resolve_router(&self) -> Router {
if self.config.mount_point == "/" {
return self.router.clone();

File Metadata

Mime Type
text/plain
Expires
Fri, Sep 26, 00:37 (20 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3017675
Default Alt Text
D3723.diff (1 KB)

Event Timeline