use crate::parser::char::is_ucschar;
use crate::spec::{IriSpec, UriSpec};
pub trait Sealed: SpecInternal {}
impl Sealed for IriSpec {}
impl Sealed for UriSpec {}
pub trait SpecInternal: Sized {
#[must_use]
fn is_nonascii_char_unreserved(c: char) -> bool;
#[must_use]
fn is_nonascii_char_private(c: char) -> bool;
}
impl SpecInternal for IriSpec {
#[inline]
fn is_nonascii_char_unreserved(c: char) -> bool {
is_ucschar(c)
}
fn is_nonascii_char_private(c: char) -> bool {
matches!(
u32::from(c),
0xE000..=0xF8FF |
0xF_0000..=0xF_FFFD |
0x10_0000..=0x10_FFFD
)
}
}
impl SpecInternal for UriSpec {
#[inline]
fn is_nonascii_char_unreserved(_: char) -> bool {
false
}
#[inline]
fn is_nonascii_char_private(_: char) -> bool {
false
}
}