confused 0.1.2

treat scary functions with the respect they deserve
Documentation
  • Coverage
  • 66.67%
    2 out of 3 items documented2 out of 2 items with examples
  • Size
  • Source code size: 5.99 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 284.15 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 5s Average build duration of successful builds.
  • all releases: 5s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • grouting

Confused

Do you ever find yourself using a function that intimidates you? Are there functions so terrifying, mere comments do not sufficiently warn unwitting callers of its infinite complexity and unknowability?

With the confusion!() and confused!() macros, you can easily mark a scary function as such:

fn main() -> Result<(), ()> {
	if scary_function(666)?????????? {
		println!("oh shit, oh fuck");
	}

	Ok(())
}

fn scary_function(evil_number: u16) -> confusion!(10, bool) {
	confused!(10, evil_number == 666)
}

Syntax

confusion!(n, ok, err = ())

n is the depth of the Result<...> chain

ok is the type of the final Ok value

err is an optional Err type, if you actually want to use this for error handling

confused!(n, expr)

n is the depth of the Ok(...) chain expr is the final result