Skip to main content

validate

Function validate 

Source
pub fn validate(value: &str) -> Result<(), UriError>
Expand description

Checks a string against the generic URI rules.

use didbot_schema::format::uri;
assert!(uri::validate("https://example.com/path?q=1#frag").is_ok());
assert!(uri::validate("did:key:zQ3sh").is_ok());
assert!(uri::validate("content-type:text/plain").is_ok());
assert!(uri::validate("example.com").is_err()); // no scheme
assert!(uri::validate("http:").is_err());       // nothing after the scheme