#uri #validation #lib #parser

rfc2396

A library for validating strings as RFC2396-compliant URIs

6 stable releases

1.1.0 Jan 24, 2021
1.0.5 Jan 12, 2021
1.0.4 Jan 2, 2021
1.0.3 Dec 28, 2020
1.0.2 Dec 27, 2020

#21 in #validator

MIT license

120KB
3K SLoC

RFC2396 - Rust

Overview

A Rust library for validating strings as RFC2396-compliant URIs

docs.io documentation crates.io version crates.io downloads Gitlab pipeline status Gitlab code coverage Lines of code Dependents License

Versioning

This project follows Semantic Versioning principals starting with 1.0.0.

Repository information

This repository is located on GitLab.com.

Usage

To use this crate, simply call one of the validate* functions, depending on your use case and desired return type:

  • validate(S) -> bool
  • validate_nom(S) -> nom::IResult<&str, &str>
  • validate_opt(S) -> Option<&str>
  • validate_res(S) -> anyhow::Result<&str>

Where S is some type that implements Into<&str>; for example, &str itself!

All functions except the _nom variant will additionally ensure that the entire input is consumed and matches exactly what was parsed internally. If you require that this check is not done (e.g. as part of a larger parsing exercise), then use the _nom variant.

Limitations

This crate does not provide a data structure with which components of a URI are represented by.

Dependencies

~2.5MB
~47K SLoC