better-url 0.12.0

A better URL crate.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Non-special URLs.

use crate::prelude::*;

mod host;
mod path;
mod opaque_path;

impl BetterUrl {
    /// [`SchemeType::NonSpecial`].
    pub(super) fn new_non_special_str(scheme: Scheme<'_>, rest: &str) -> Result<Self, InvalidUrl> {
        match rest.as_bytes() {
            [b'/', b'/', ..]  => Self::new_ns_host_str       (scheme, &rest[2..]),
            [b'/',       ..]  => Self::new_ns_path_str       (scheme, rest),
            _                 => Self::new_ns_opaque_path_str(scheme, rest),
        }
    }
}