dattrs ~main
D classes with less boilerplate
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:
dattrs
dattrs is a riff on Python's attrs. It removes the need for writing boring boilerplate class constructors.
Use it like so:
/* You MUST import the entire dattrs module,
dont just import `define`.
*/
import dattrs;
class wibble
{
mixin define!(["donkey"], string);
}
auto w = new wibble("hello");
writeln(w.donkey); //"hello"
You may also define default values for the attributes, and optionally offer a no-parameter constructor.
class wibble
{
name value overload type
mixin define_defaults!(["donkey"], ["hello"], true, string);
}
- ~main released 4 years ago
- samathy/dattrs
- MIT
- Copyright © 2020, Samathy Barratt
- Authors:
- Dependencies:
- none
- Versions:
-
2.1.0 2020-Dec-31 2.0.0 2020-Dec-31 1.0.1 2020-Dec-31 1.0.0 2020-Dec-31 ~main 2020-Dec-31 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
0 downloads total
-
- Score:
- 0.3
- Short URL:
- dattrs.dub.pm