pub struct Scheme { /* private fields */ }Expand description
A scheme component.
§Comparison
Schemes 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) -> &Self
pub const fn new_or_panic(s: &str) -> &Self
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.
Source§impl Scheme
impl Scheme
Sourcepub fn default_port(&self) -> Option<u16>
pub fn default_port(&self) -> Option<u16>
Returns the optional default port of the scheme if it is registered at IANA with a permanent status.
The following table lists all schemes concerned, their default ports, and references:
| Scheme | Port | Reference |
|---|---|---|
| aaa | 3868 | RFC 6733 |
| aaas | 5658 | RFC 6733 |
| acap | 674 | RFC 2244 |
| cap | 1026 | RFC 4324 |
| coap | 5683 | RFC 7252 |
| coap+tcp | 5683 | RFC 8323 |
| coap+ws | 80 | RFC 8323 |
| coaps | 5684 | RFC 7252 |
| coaps+tcp | 5684 | RFC 8323 |
| coaps+ws | 443 | RFC 8323 |
| dict | 2628 | RFC 2229 |
| dns | 53 | RFC 4501 |
| ftp | 21 | RFC 1738 |
| go | 1096 | RFC 3368 |
| gopher | 70 | RFC 4266 |
| http | 80 | RFC 9110 |
| https | 443 | RFC 9110 |
| icap | 1344 | RFC 3507 |
| imap | 143 | RFC 5092 |
| ipp | 631 | RFC 3510 |
| ipps | 631 | RFC 7472 |
| ldap | 389 | RFC 4516 |
| mtqp | 1038 | RFC 3887 |
| mupdate | 3905 | RFC 3656 |
| nfs | 2049 | RFC 2224 |
| nntp | 119 | RFC 5538 |
| pop | 110 | RFC 2384 |
| rtsp | 554 | RFC 7826 |
| rtsps | 322 | RFC 7826 |
| rtspu | 554 | RFC 2326 |
| snmp | 161 | RFC 4088 |
| stun | 3478 | RFC 7064 |
| stuns | 5349 | RFC 7064 |
| telnet | 23 | RFC 4248 |
| tip | 3372 | RFC 2371 |
| tn3270 | 23 | RFC 6270 |
| turn | 3478 | RFC 7065 |
| turns | 5349 | RFC 7065 |
| vemmi | 575 | RFC 2122 |
| vnc | 5900 | RFC 7869 |
| ws | 80 | RFC 6455 |
| wss | 443 | RFC 6455 |
| z39.50r | 210 | RFC 2056 |
| z39.50s | 210 | RFC 2056 |