diff options
| author | Fuwn <[email protected]> | 2022-03-26 09:22:06 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-03-26 09:22:06 +0000 |
| commit | 21501a1f1a39a9b9137003803c1da6d99e60263e (patch) | |
| tree | 5f5c2bae45b2cadaa2f620b6a2c34966d0e7cd18 /src/response.rs | |
| parent | feat(response): variable responses (diff) | |
| download | windmark-21501a1f1a39a9b9137003803c1da6d99e60263e.tar.xz windmark-21501a1f1a39a9b9137003803c1da6d99e60263e.zip | |
refactor(response): minify status handling
Diffstat (limited to 'src/response.rs')
| -rw-r--r-- | src/response.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/response.rs b/src/response.rs index 0a22750..0a4b79e 100644 --- a/src/response.rs +++ b/src/response.rs @@ -31,3 +31,26 @@ pub enum Response { NotFound(String), PermanentFailure(String), } + +pub(crate) fn to_value_set_status( + response: Response, + status: &mut i32, +) -> String { + match response { + Response::Success(value) => { + *status = 20; + + value + } + Response::NotFound(value) => { + *status = 51; + + value + } + Response::PermanentFailure(value) => { + *status = 50; + + value + } + } +} |