use crate::prelude::*;
impl BetterUrl {
pub fn canon_get_href(&self) -> &str {
&self.serialization
}
pub fn canon_get_protocol(&self) -> &str {
&self.serialization[..= self.details.scheme_mark as usize]
}
pub fn canon_get_username(&self) -> &str {
self.username_str()
}
pub fn canon_get_password(&self) -> &str {
self.password_str()
}
pub fn canon_get_hostname(&self) -> &str {
self.host_str().unwrap_or_default()
}
pub fn canon_get_host(&self) -> &str {
self.host_port_str().unwrap_or_default()
}
pub fn canon_get_port(&self) -> &str {
self.port_str().unwrap_or_default()
}
pub fn canon_get_pathname(&self) -> &str {
self.path_str()
}
pub fn canon_get_search(&self) -> &str {
let x = match self.details.query_mark {
Some(x) => unsafe {self.serialization.get_unchecked(x.get() as usize .. self.details.fragment_mark.map_or(self.len(), |x| x.get() as usize))},
None => "",
};
if x == "?" {
""
} else {
x
}
}
pub fn canon_get_hash(&self) -> &str {
let x = match self.details.fragment_mark {
Some(x) => unsafe {self.serialization.get_unchecked(x.get() as usize ..)},
None => "",
};
if x == "#" {
""
} else {
x
}
}
}