Skip to content
CryoCryo home
Stdlibnet::http

status

import std::net::http::status; · source

Types

StatusCode

type struct StatusCode {
    code: u16;

    static from_u16(code: u16) -> StatusCode;
    as_u16(&this) -> u16;
    static continue_() -> StatusCode;
    static switching_protocols() -> StatusCode;
    static ok() -> StatusCode;
    static created() -> StatusCode;
    static accepted() -> StatusCode;
    static no_content() -> StatusCode;
    static moved_permanently() -> StatusCode;
    static found() -> StatusCode;
    static not_modified() -> StatusCode;
    static temporary_redirect() -> StatusCode;
    static permanent_redirect() -> StatusCode;
    static bad_request() -> StatusCode;
    static unauthorized() -> StatusCode;
    static forbidden() -> StatusCode;
    static not_found() -> StatusCode;
    static method_not_allowed() -> StatusCode;
    static conflict() -> StatusCode;
    static length_required() -> StatusCode;
    static payload_too_large() -> StatusCode;
    static unsupported_media_type() -> StatusCode;
    static too_many_requests() -> StatusCode;
    static internal_server_error() -> StatusCode;
    static not_implemented() -> StatusCode;
    static bad_gateway() -> StatusCode;
    static service_unavailable() -> StatusCode;
    static gateway_timeout() -> StatusCode;
    is_informational(&this) -> boolean;
    is_success(&this) -> boolean;
    is_redirection(&this) -> boolean;
    is_client_error(&this) -> boolean;
    is_server_error(&this) -> boolean;
    reason_phrase(&this) -> Str;
}

A wrapper over the numeric code with named constructors across the ranges. from_u16 accepts anything, so an unusual code still round-trips; reason_phrase() gives the standard text for the ones it knows.

Properties

PropertyType
codeu16

Constructors

static from_u16(code: u16) -> StatusCode;
static continue_() -> StatusCode;
static switching_protocols() -> StatusCode;
static ok() -> StatusCode;
static created() -> StatusCode;
static accepted() -> StatusCode;
static no_content() -> StatusCode;
static moved_permanently() -> StatusCode;
static found() -> StatusCode;
static not_modified() -> StatusCode;
static temporary_redirect() -> StatusCode;
static permanent_redirect() -> StatusCode;
static bad_request() -> StatusCode;
static unauthorized() -> StatusCode;
static forbidden() -> StatusCode;
static not_found() -> StatusCode;
static method_not_allowed() -> StatusCode;
static conflict() -> StatusCode;
static length_required() -> StatusCode;
static payload_too_large() -> StatusCode;
static unsupported_media_type() -> StatusCode;
static too_many_requests() -> StatusCode;
static internal_server_error() -> StatusCode;
static not_implemented() -> StatusCode;
static bad_gateway() -> StatusCode;
static service_unavailable() -> StatusCode;
static gateway_timeout() -> StatusCode;

Methods

as_u16(&this) -> u16;
is_informational(&this) -> boolean;
is_success(&this) -> boolean;
is_redirection(&this) -> boolean;
is_client_error(&this) -> boolean;
is_server_error(&this) -> boolean;
reason_phrase(&this) -> Str;

Canonical reason phrase for the common codes. Unknown codes return "Unknown"; a caller that cares about round-tripping a custom phrase should track its own mapping.