canImport

Determines if a module can be imported, allowing to create optional static branches.

enum bool canImport(string mod);

Examples

1 // likely importable...
2 static if (canImport!"std.stdio") {} else {assert(false);}
3 // not so much...
4 static if (canImport!"std.experimental.xml") {assert(false);}
5 static if (canImport!"std.experimental.color") {assert(false);}

Meta