tofunction 0.0.2

Converts a callable to a function.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

toFunction

While reading Phobos documentation, have you ever wondered: Why does it have toDelegate, but not a corresponding toFunction?

Well, wonder no more! For it is now here, -BEHOLD-!

import tofunction;

int x = 0;
int delegate(int) dg = y => y*x;

int function(int) fn = toFunction(dg);

x = 6;
assert(fn(7) == 42, "The answer is 42!");

// Don't forget to free!
freeFunction(fn);

This library has only two functions:

  • toFunction: Opposite of toDelegate.
  • freeFunction: Releases resources allocated by toFunction.

This library is compatible with multithreading.

Authors:
  • Tomas
Dependencies:
none
Versions:
0.0.2 2026-Aug-02
0.0.1 2026-Aug-02
~master 2026-Aug-02
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 2 downloads this week

  • 2 downloads this month

  • 2 downloads total

Score:
0.7
Short URL:
tofunction.dub.pm