๐Ÿ“ฆ fffonion / mi_result.rs

โ˜… 3 stars โ‘‚ 0 forks ๐Ÿ‘ 3 watching
๐Ÿ“ฅ Clone https://github.com/fffonion/mi_result.rs.git
HTTPS git clone https://github.com/fffonion/mi_result.rs.git
SSH git clone git@github.com:fffonion/mi_result.rs.git
CLI gh repo clone fffonion/mi_result.rs
Wangchong Zhou Wangchong Zhou chore(ci): make it feel more real b1e7726 1 months ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ src
๐Ÿ“„ .gitignore
๐Ÿ“„ Cargo.lock
๐Ÿ“„ Cargo.toml
๐Ÿ“„ README.md
๐Ÿ“„ README.md

MiResult

This project is not affiliated with or endorsed by the XiaoMi company.

Small extension trait for Rust's Result providing a friendlier are_you_ok() method that mirrors is_ok().

Usage

use mi_result::MiResult;

fn main() {
    let mi_fans: Result<i32, &str> = Ok(42);
    assert!(mi_fans.are_you_ok());

    let mi_fans: Result<i32, &str> = Err("nope");
    assert!(!mi_fans.are_you_ok());
}

Development

  • Run tests: cargo test

Notes

  • Crate is published as mi_result; the internal trait is MiResult.