Accord

Build Status Current Crates.io Version

⚠️ Accord uses the unstable feature [conservativeimpltrait] and thus requires nightly until the feature lands in beta/stable.

Accord is a library for validating data according to rules like "contains", "length", "either".

Accord is two fold, the first part being a set of validator-functions that for example tests that a String is a minimum 5 characters long or that an i32 is either 10 or 20, and the second part being a set of primitives that enables you to pair these validators and run a "validation suite" on the contents of a struct or any other data, to make sure that it contains what you expect it does and if not, it returns useful error messages that can be shown to a user to help the user fix the validation issue.

Usage tl;dr:

```rust

[macro_use]

extern crate accord;

use accord::validate; use accord::validators::{length, contains, range};

fn main() { let email = "test@test.test".tostring(); let password = "kfjsdkfjsdkfjfksjdfkdsfjs".tostring(); let age = 25;

let errors = rules!{
    email => [length(5, 64), contains("@"), contains(".")],
    password => [length(8, 64)],
    age => [range(12, 127)]
};

} ```

Documentation

Building locally

Nightly

Accord requires a nightly version of Rust since it uses the feature [conservativeimpltrait] which is not available in neither the beta or stable version yet.

Building: cargo build

Testing: cargo test

Contributing

Contributions are absolutely, positively welcome and encouraged! Contributions come in many forms. You could:

  1. Submit a feature request or bug report as an issue.
  2. Ask for improved documentation as an issue.
  3. Contribute code via pull requests.

To keep a high standard of quality, contributed code must be:

All pull requests are code reviewed and tested by the CI. Note that unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Accord by you shall be MIT License without any additional terms or conditions.

Thanks to [Rocket] for showing how to form a great contributing-section.

License

Accord is Copyright (c) 2016 Christoffer Buchholz. It is free software, and may be redistributed under the terms specified in the [LICENSE] file.