Skip to main content

Crate use_status

Crate use_status 

Source
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§

HttpStatus
A common HTTP status code and its standard reason phrase.

Enums§

StatusClass
A broad HTTP status code class.

Functions§

is_cacheable_by_default
Returns true for codes that are cacheable by default in common HTTP semantics.
is_client_error
Returns true when the code is a client error.
is_error
Returns true when the code is a client or server error.
is_informational
Returns true when the code is informational.
is_redirect
Returns true when the code is a redirect.
is_server_error
Returns true when the code is a server error.
is_success
Returns true when 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.