Skip to content
CryoCryo home
Stdlibnet::http

method

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

Types

Method

type enum Method {
    Get;
    Head;
    Post;
    Put;
    Delete;
    Connect;
    Options;
    Trace;
    Patch;
}

implement enum Method {
    as_str(&this) -> Str;
    static parse(source: Str) -> Result<Method, ConversionError>;
    static parse_opt(source: Str) -> Option<Method>;
}

The standard verbs. as_str gives the wire spelling; parse and parse_opt read one — parse reports an unknown verb as a ConversionError, parse_opt as None.

Variants

Variant
Get
Head
Post
Put
Delete
Connect
Options
Trace
Patch

Constructors

static parse(source: Str) -> Result<Method, ConversionError>;

Parse the uppercase wire form. Returns Err(ConversionError) on unknown methods rather than inventing a variant; the caller decides whether to 405 or to treat as a bad request. The error is describable/printable - consistent with the other stdlib parsers. Use parse_opt for the detail-free variant.

static parse_opt(source: Str) -> Option<Method>;

Detail-free variant of parse: None on unknown methods.

Methods

as_str(&this) -> Str;

Uppercase wire form.