soft 0.1.1

Provides soft, non-panicking assertions.
Documentation
  • Coverage
  • 0%
    0 out of 8 items documented0 out of 0 items with examples
  • Size
  • Source code size: 8.22 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.85 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • fabianboesiger/soft
    3 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • fabianboesiger

Soft Assertions

This library provides soft, non-panicking assertions. Instead, the assertions provided by this crate return a Result. To use this crate, simply replace assert!(...) by soft::assert!(...)?.

Example

fn main() {
    soft::panic!(false).unwrap_err();

    soft::assert!(true).unwrap();
    soft::assert!(false).unwrap_err();

    soft::assert_eq!(2, 2).unwrap();
    soft::assert_eq!(2, 3).unwrap_err();
    
    soft::assert_ne!(2, 3).unwrap();
    soft::assert_ne!(2, 2).unwrap_err();
}