pavex::http

Module uri

Expand description

URI component of request and response lines

This module primarily contains the Uri type which is a component of all HTTP requests and also reexports this type at the root of the crate. A URI is not always a “full URL” in the sense of something you’d type into a web browser, but HTTP requests may only have paths on servers but may have full schemes and hostnames on clients.

§Examples

use http::Uri;

let uri = "/foo/bar?baz".parse::<Uri>().unwrap();
assert_eq!(uri.path(), "/foo/bar");
assert_eq!(uri.query(), Some("baz"));
assert_eq!(uri.host(), None);

let uri = "https://www.rust-lang.org/install.html".parse::<Uri>().unwrap();
assert_eq!(uri.scheme_str(), Some("https"));
assert_eq!(uri.host(), Some("www.rust-lang.org"));
assert_eq!(uri.path(), "/install.html");

Structs§

  • Represents the authority component of a URI.
  • A builder for Uris.
  • An error resulting from a failed attempt to construct a URI.
  • An error resulting from a failed attempt to construct a URI.
  • The various parts of a URI.
  • Represents the path component of a URI
  • The port component of a URI.
  • Represents the scheme component of a URI
  • The URI component of a request.