funkjon 1.0.2

One of the worst macros this world has ever been (dis)graced with.
Documentation
  • Coverage
  • 0%
    0 out of 2 items documented0 out of 1 items with examples
  • Size
  • Source code size: 5.21 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 244.37 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
  • david-d-h

Funkjon - a bad macro

With funkjon, you too can create your very own function.

Usage:

funkjon!(greet :: name {
    println!("Hello, {name}.");
} as (String) -> Unit);

greet("David".to_string());

By the way, Unit is the return type. It is equivalent to (). You can change it by just putting something other than Unit next to the right arrow (->).

Usage with generics:

funkjon!(greet ::<T: std::fmt::Display>:: name {
    println!("Hello, {name}.");
} as (T) -> Unit);

greet("David");

Or with a where clause

funkjon!(greet ::<T>:: name {
    println!("Hello, {name}.");
} as (T) -> Unit
    where T: std::fmt::Display,
);

greet("David");