| Crates.io | adequate |
| lib.rs | adequate |
| version | 0.1.5 |
| created_at | 2020-10-15 19:48:26.6798+00 |
| updated_at | 2025-03-02 07:24:32.064032+00 |
| description | A yet another validation library provides a macro inspired by Accord. |
| homepage | https://codeberg.org/grauwoelfchen/adequate |
| repository | https://codeberg.org/grauwoelfchen/adequate |
| max_upload_size | |
| id | 300180 |
| size | 53,842 |
A yet another validation library provides a macro inspired by Accord.
This library is developed mainly on Codeberg.org, but the source code is hosted also on sourcehut.
Any patches, merge/pull requests or issues on those repositories are welcomed.
# the main branch is "trunk"
% git clone git@codeberg.org:grauwoelfchen/adequate.git
% git --no-pager branch -v
* trunk xxxxxxx XXX
% cargo install adequate
TODO: Add more detailed examples
See src/validation directory for validators.
use adequate::validation::{contain, length};
// input
let fullname = Some("Albrecht Dürer".to_string());
let username = "albrecht".to_string();
let result = validate! {
"fullname" => fullname => [
length::max_if_present(3)
],
"username" => username => [
length::within(3..9),
contain::contains_only_alphanumeric_chars(),
],
};
assert!(result.is_err());
max
max_if_present
min
min_if_present
within
See help as below:
% make help
% make check
% make fmt
% make lint
# check code using all these vet-{check,format,lint} targets at once
% make vet
% make test
# check the report by kcov
% make cov
# debug build
% make build
All 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.