1 unstable release

0.1.0 Jun 6, 2022

#12 in #replacing

MIT license

10KB
156 lines

its_ok

Provides ok and ok_unchecked macros for replacing ? with unwrap and unwrap_unchecked calls.

Example

use its_ok::ok;
use std::io::Write;

ok! {
    let mut buffer = Vec::new();
    buffer.write_all(b"bytes")?;
}

// The code above gets expanded into this.
let mut buffer = Vec::new();
buffer.write_all(b"bytes").unwrap();

lib.rs:

Provides [ok!] and ok_unchecked! macros for replacing ? with unwrap and unwrap_unchecked calls.

Examples

use its_ok::ok;
use std::io::Write;

ok! {
    let mut buffer = Vec::new();
    buffer.write_all(b"bytes")?;
}

// The code above gets expanded into this.
let mut buffer = Vec::new();
buffer.write_all(b"bytes").unwrap();

Dependencies

~1.5MB
~37K SLoC