sysreq 0.1.7

Simple, virtually-zero-dependencies HTTP client wrapping a system client
Documentation
1
2
3
4
5
6
7
8
9
10
11
pub trait ValidUrl: AsRef<str> {
	fn validate(&self) -> Result<&str, super::Error> {
		let url = url::Url::parse(self.as_ref())?;
		if matches!(url.scheme(), "http" | "https") {
			Ok(self.as_ref())
		} else {
			Err(super::Error::InvalidUrlScheme)
		}
	}
}
impl<S: AsRef<str>> ValidUrl for S {}