docs.rs failed to build preflight-0.1.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
preflight
The validate!
macro validates a given input with a given set of validation
functions and iterate over the errors. For example:
extern crate preflight;
use ;
let mut errors = Vec new;
validate!;
In the above example the validate!
macro expands to:
if let Err = max_len
if let Err = url_with_scheme
Notice how the first expression is automatically passed as the first argument to all listed validation functions.
Since needing to validate values inside Option
s is very common,
this crate also provides a validate_opt!
macro:
validate_opt!;
is equivalent to
if let Some = profile_url
You can easily define your own validation functions, you just need
to return a Result
and take the input as the first argument.