url_validator

Crates.iourl_validator
lib.rsurl_validator
version0.1.4
sourcesrc
created_at2023-11-01 20:26:01.885581
updated_at2023-11-02 15:03:11.789581
descriptionA Rust crate for URL validation
homepage
repository
max_upload_size
id1021745
size7,653
(mAmineChniti)

documentation

README

URL Validator

A Rust crate for URL validation.

License: MIT Crates.io Docs.rs

Introduction

URL Validator is a simple and lightweight Rust crate that allows you to check if a given string is a valid URL according to specific criteria. It's useful for ensuring that URLs in your Rust applications and scripts meet certain standards.

Features

  • Validates URLs based on the following criteria:
    • URL must contain a valid scheme (e.g., "http", "https", "ftp").
    • Scheme and the rest of the URL cannot be empty.
    • URL must contain "://" exactly once.
    • The rest of the URL should consist of valid characters: alphanumeric, '.', '-', ':', and '/'.
  • Easy integration into your Rust projects.

Installation

To use this crate in your Rust project, add it as a dependency in your Cargo.toml:

[dependencies]
url_validator = "0.1.4"

Usage

Incorporate this crate into your Rust application to perform URL validation. The primary function, is_valid_url, returns true if the URL is valid and false otherwise.

extern crate url_validator;

use url_validator::is_valid_url;

fn main() {
    let url = "https://www.example.com";
    let is_valid = is_valid_url(url);

    if is_valid {
        println!("Valid URL: {}", url);
    } else {
        println!("Invalid URL: {}", url);
    }
}

Contributing

Contributions to this project are welcome. If you have any ideas for improvements, new features, or bug fixes, feel free to open an issue or submit a pull request on GitHub.

License

This crate is open-source and available under the MIT License. You can use it in your projects for free and modify it according to your needs.

Enjoy using URL Validator in your Rust projects! If you have any questions or encounter issues, don't hesitate to reach out.

Commit count: 0

cargo fmt