pub struct Scheme { /* private fields */ }
Expand description
A scheme component.
§Comparison
Scheme
s are compared case-insensitively. You should do a case-insensitive
comparison if the scheme specification allows both letter cases in the scheme name.
§Examples
use fluent_uri::{component::Scheme, Uri};
const SCHEME_HTTP: &Scheme = Scheme::new_or_panic("http");
let scheme = Uri::parse("HTTP://EXAMPLE.COM/")?.scheme();
// Case-insensitive comparison.
assert_eq!(scheme, SCHEME_HTTP);
// Case-sensitive comparison.
assert_eq!(scheme.as_str(), "HTTP");
Implementations§
source§impl Scheme
impl Scheme
sourcepub const fn new_or_panic(s: &str) -> &Scheme
pub const fn new_or_panic(s: &str) -> &Scheme
Converts a string slice to &Scheme
.
§Panics
Panics if the string is not a valid scheme name according to
Section 3.1 of RFC 3986. For a non-panicking variant,
use new
.