yeet_ops/
lib.rs

1#![doc = include_str!("../README.md")]
2#![deny(unsafe_code)]
3#![no_std]
4
5// This one is the magic feature flag to allow yeeting in the first place
6#![feature(yeet_expr)]
7
8
9/// Yeet your error case up to the caller.
10/// 
11/// This is essentially a direct translation to the `do yeet` statement, 
12/// but a bit funnier because of being able to type `yeet!` in your code.
13/// 
14/// ## Example
15/// 
16/// ```
17/// #![feature(yeet_expr)]
18/// use yeet_ops::yeet;
19/// 
20/// /// A function that yeets `None`
21/// fn test() -> Option<i32> {
22///     yeet!();
23/// }
24/// 
25/// # fn main() {
26/// // Did it yeet?
27/// assert_eq!(test(), None);
28/// # }
29/// ```
30#[macro_export]
31macro_rules! yeet {
32    // Expressions can be yote
33    ($expr:expr) => {
34        do yeet $expr
35    };
36    // If nothing is yote, the `do yeet` should return the default value? Basically just `None` afaik
37    () => {
38        do yeet
39    };
40}