Note
This repository has been moved. Please check the new locations below.
- ~grauwoelfchen/adequate on Sourcehut
- grauwoelfchen/adequate on Codeberg
A yet another validation library provides a macro inspired by Accord.
This is mainly developed on GitLab.com, but the source code is hosted also in several following repositories.
Any merge/pull requests or issues on any repository are welcomed.
- https://gitlab.com/grauwoelfchen/adequate
- https://github.com/grauwoelfchen/adequate
- https://git.sr.ht/~grauwoelfchen/adequate
# the main branch is "trunk"
% git clone git@gitlab.com:grauwoelfchen/adequate.git
% git --no-pager branch -v
* trunk xxxxxxx XXX% cargo install adequateSee src/validation directory for validators.
use adequate::validation::length;
// inputs
let v1 = "Albrecht Dürer";
let v2 = "albrecht";
let result = validate! {
"fullname" => v1 => [length::max(3)],
"username" => v2 => [length::within(3..9)],
};
assert!(result.is_err());- contains
- contains_if_present
- contains_if_given
- not_contain_if_given
- max
- max_if_present
- min
- min_if_present
- within
Check make help
# debug build
% make build:debug# check code using all vet:xxx targets
% make vet:all% make test
# or check the report by kcov
% make coverageRun CI jobs on local docker conatiner (Gentoo Linux) using gitlab-runner.
See .gitlab-ci.yml.
# prepare environment variables for CI via .env.ci
% cp .env.ci.sample .env
# e.g. test (see .gitlab-ci.yml)
% make runner-testAll notable released changes of this package will be documented in CHANGELOG file.
Adequate
Copyright 2020-2025 Yasha
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.