Expand description
§use-status
Small HTTP status utilities for RustUse.
§Experimental
use-status is experimental while the use-web workspace remains below 0.3.0. Expect small API adjustments during the first release wave.
§Example
use use_status::{is_error, reason_phrase, status_class};
assert_eq!(reason_phrase(404), Some("Not Found"));
assert_eq!(status_class(201), Some(use_status::StatusClass::Success));
assert!(is_error(503));§Scope
- Reason-phrase lookup for common status codes.
- Classification helpers for response classes.
- Small utility predicates for application and tooling code.
§Non-goals
- HTTP server implementations.
- HTTP client implementations.
- Policy engines.
§License
Licensed under either of the following, at your option:
- Apache License, Version 2.0
- MIT license
Structs§
- Http
Status - A common HTTP status code and its standard reason phrase.
Enums§
- Status
Class - A broad HTTP status code class.
Functions§
- is_
cacheable_ by_ default - Returns
truefor codes that are cacheable by default in common HTTP semantics. - is_
client_ error - Returns
truewhen the code is a client error. - is_
error - Returns
truewhen the code is a client or server error. - is_
informational - Returns
truewhen the code is informational. - is_
redirect - Returns
truewhen the code is a redirect. - is_
server_ error - Returns
truewhen the code is a server error. - is_
success - Returns
truewhen the code is successful. - reason_
phrase - Returns the standard reason phrase for a common status code.
- status_
class - Returns the broad HTTP status class for a code in the standard range.