Skip to content

Commit 9c772d7

Browse files
committed
improve StatusCode docs for supported range
1 parent b9efebf commit 9c772d7

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/status.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ use std::str::FromStr;
2222

2323
/// An HTTP status code (`status-code` in RFC 7230 et al.).
2424
///
25-
/// This type contains constants for all common status codes.
26-
/// It allows status codes in the range [100, 999].
25+
/// Constants are provided for known status codes, including those in the IANA
26+
/// [HTTP Status Code Registry](
27+
/// https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml).
2728
///
28-
/// IANA maintain the [Hypertext Transfer Protocol (HTTP) Status Code
29-
/// Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml) which is
30-
/// the source for this enum (with one exception, 418 I'm a teapot, which is
31-
/// inexplicably not in the register).
29+
/// Status code values in the range 100-999 (inclusive) are supported by this
30+
/// type. Values in the range 100-599 are semantically classified by the most
31+
/// significant digit. See [`StatusCode::is_success`], etc. Values above 599
32+
/// are unclassified but allowed for legacy compatibility, though their use is
33+
/// discouraged. Applications may interpret such values as protocol errors.
3234
///
3335
/// # Examples
3436
///
@@ -54,7 +56,7 @@ impl StatusCode {
5456
/// Converts a u16 to a status code.
5557
///
5658
/// The function validates the correctness of the supplied u16. It must be
57-
/// greater or equal to 100 but less than 1000.
59+
/// greater or equal to 100 and less than 1000.
5860
///
5961
/// # Example
6062
///
@@ -530,7 +532,7 @@ impl fmt::Display for InvalidStatusCode {
530532
impl Error for InvalidStatusCode {}
531533

532534
// A string of packed 3-ASCII-digit status code values for the supported range
533-
// of (100..=999)
535+
// of [100, 999] (900 codes, 2700 bytes).
534536
const CODE_DIGITS: &'static str = "\
535537
100101102103104105106107108109110111112113114115116117118119\
536538
120121122123124125126127128129130131132133134135136137138139\

0 commit comments

Comments
 (0)