`matchable` provides a convenient enum for checking if a piece of text is matching a string or a regex.

Overview

matchable

Crates.io docs.rs

matchable provides a convenient enum for checking if a piece of text is matching a string or a regex.

The common usage of this crate is used as configuration value type with serde feature enabled (disabled by default), then user can pass string and/or regex in just one enum. Later, you can use that enum to check if a piece of text is matching the string/regex or not.

Example

use matchable::Matchable;

assert!(Matchable::Str("Abc".into()).is_match("Abc"));
assert!(!Matchable::Str("Abc".into()).is_match("abc"));
assert!(Matchable::Regex(regex::Regex::new("abc.").unwrap()).is_match("abcd"));

License

MIT License

Copyright (c) 2022-present Pig Fang

You might also like...
An extremely fast glob matching library in Rust.

glob-match An extremely fast glob matching library with support for wildcards, character classes, and brace expansion. Linear time matching. No expone

A simple yet convenient cross-platform ARP spoofer

ruuf - A simple yet convenient cross-platform ARP spoofer Poison the ARP cache of the given victim, thereby redirecting the traffic to the target ther

A more convenient `#[target_feature]` replacement

A more convenient #[target_feature] replacement To get good performance out of SIMD everything on the SIMD codepath must be inlined. With how SIMD is

xyz is a chat platform where people sign up, play a matching game, and say goodbye
xyz is a chat platform where people sign up, play a matching game, and say goodbye

xyz is an asynchronous chat and web service What you need Docker Desktop 🐳 Cargo (Rust package manager) 📦 Clone our project Follow the steps below t

nvim-oxi provides safe and idiomatic Rust bindings to the rich API exposed by the Neovim text editor.

🔗 nvim-oxi nvim-oxi provides safe and idiomatic Rust bindings to the rich API exposed by the Neovim text editor. The project is mostly intended for p

An implementation of Piet's text interface using cosmic-text

piet-cosmic-text Implements piet's Text interface using the cosmic-text crate. License piet-cosmic-text is free software: you can redistribute it and/

git-cliff can generate changelog files from the Git history by utilizing conventional commits as well as regex-powered custom parsers.⛰️
git-cliff can generate changelog files from the Git history by utilizing conventional commits as well as regex-powered custom parsers.⛰️

git-cliff can generate changelog files from the Git history by utilizing conventional commits as well as regex-powered custom parsers. The changelog template can be customized with a configuration file to match the desired format.

A tui to test regexes on the rust regex crate

regex-tui Structure src/ ├── app.rs - holds the states and renders the widgets ├── event.rs - handles the terminal events (key press, mouse cl

A visual regex substitution tool
A visual regex substitution tool

A visual regex substitution tool

Releases(v0.1.1)
Owner
Pig Fang
Errors should be human-friendly.
Pig Fang
Irx-config - The library provides convenient way to represent/parse configuration from different sources

The irx-config library provides convenient way to represent/parse configuration from different sources. The main goals is to be very easy to use and t

Andriy Bakay 2 Sep 14, 2022
This library provides a convenient derive macro for the standard library's std::error::Error trait.

derive(Error) This library provides a convenient derive macro for the standard library's std::error::Error trait. [dependencies] therror = "1.0" Compi

Sebastian Thiel 5 Oct 23, 2023
A cargo subcommand for checking and applying updates to installed executables

cargo-update A cargo subcommand for checking and applying updates to installed executables Documentation Manpage Installation Firstly, ensure you have

наб 827 Jan 4, 2023
Execute Rust code carefully, with extra checking along the way

cargo-careful cargo careful is a tool to run your Rust code extra carefully -- opting into a bunch of nightly-only extra checks that help detect Undef

Ralf Jung 240 Dec 28, 2022
CLI tool for checking ProtonDB compatibility of your Steam games.

protondb-check protondb-check is currently in active development stage, there might be bugs or other problems. Table Of Contents About Available comma

Giorgi Anakidze 3 Apr 1, 2024
Simple but convenient CLI-based Matrix client app for sending and receiving (in Rust)

matrix-commander-rs simple but convenient CLI-based Matrix client app for sending and receiving Help create this Rust program! This project is current

null 19 Dec 30, 2022
simple but convenient CLI-based Nostr client app for following users and sending DMs

nostr-commander-rs TLDR: simple but convenient CLI-based Nostr client app for publishing, sending DMs, as well as following users and channels nostr-c

null 18 Dec 30, 2022
rpsc is a *nix command line tool to quickly search for file systems items matching varied criterions like permissions, extended attributes and much more.

rpsc rpsc is a *nix command line tool to quickly search for file systems items matching varied criterions like permissions, extended attributes and mu

null 3 Dec 15, 2022
Code for working with edge-matching puzzles in the Eternity 2 family.

e2rs Code for working with edge-matching puzzles in the Eternity 2 family. This is a WIP sketch of some APIs and algs for representing and manipulatin

Matthew Pocock 3 Jan 18, 2023
A convenient macro for building PathBufs in Rust.

pathbuf pathbuf is a simple crate which provides the pathbuf macro to conveniently construct the Rust PathBuf type. Example use pathbuf::pathbuf; use

Andrew Lilley Brinker 6 Jan 16, 2023