yeet-ops 1.0.0

An accompanying library for the experimental `do yeet` statement in Rust
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented2 out of 2 items with examples
  • Size
  • Source code size: 41.37 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 89.92 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ewpratten

The yeet! macro

Crates.io Docs.rs Build Clippy Audit

yeet-ops is a super small crate to compliment the do yeet statement implemented in https://github.com/rust-lang/rust/pull/96376

This crate requires a nightly build of Rust.

Usage

Simply toss this in your Cargo.toml dependencies:

yeet-ops = "^1.0.0"

Then you are good to go!

#![feature(yeet_expr)] // Needed!
use yeet_ops::yeet;

/// A function that yeets `None`
fn test() -> Option<i32> {
    yeet!();
}

/// A function that yeets `Err(1)`
fn test2() -> Result<String, i32> {
    yeet!(1);
}

fn main() {
    // Did it yeet?
    assert_eq!(test(), None);
    assert_eq!(test2(), Err(1));
}