util

Module handles functions and templates that we lazied to factor out to separate module.

Function categories: <ul> <li> JSON de/serialization based on annotations </li> <li> Exception handling functions </li> <li> Cheat casting functions </li> <li> String processing functions (the only one fromStringz)</li> <li> Introspecting templates that cannot be found in Phobos </li> <li> Functional styled utilities for optional values and lazy ranges</li> </ul>

Members

Classes

RequiredFieldException
class RequiredFieldException
Undocumented in source.
RequiredJsonObject
class RequiredJsonObject
Undocumented in source.
TestException
class TestException
Undocumented in source.

Enums

possible
enum possible
Undocumented in source.
required
enum required
Undocumented in source.

Functions

deserializeFromJson
T deserializeFromJson(Json src)

Deserializes from Json to type T<br>

fromStringz
inout(char)[] fromStringz(inout(char)* cString)

Returns a D-style array of char given a zero-terminated C-style string. The returned array will retain the same type qualifiers as the input.

generator
auto generator(Maybe!T delegate() genfunc)

Transforms delegate into lazy range. Generation is stopped, when genfunc returns Maybe!T.nothing.

serializeRequiredToJson
Json serializeRequiredToJson(T val)

Serializes struct with @required attributes fields to Json <br>

thrower
bool thrower()
Undocumented in source. Be warned that the author may not have intended to support it.
tryEx
T tryEx(T par)

Tries to evaluate par. On exception throws Ex, otherwise return par

Imports

fromStringz (from std.string)
public import std.string : fromStringz;
Undocumented in source.

Manifest constants

APPNAME
enum APPNAME;
Undocumented in source.

Mixin templates

t_field
mixintemplate t_field(T, alias fieldName)
Undocumented in source.

Properties

tie
void tie [@property getter]

Allows to fast retreiving results from functions that returns a tuple.

Structs

Maybe
struct Maybe(T)

Struct-wrapper to handle result of computations, that can fail.

Maybe
struct Maybe(T)

Struct-wrapper to handle result of computations, that can fail.

Templates

getMemberType
template getMemberType(Class, string name)

Retrieves member type with name of class Class. If member is agregate type declaration or simply doesn't exist, retrieves no type. You can check it with is operator.

toShared
template toShared(T)

cast to shared type T

toUnqual
template toUnqual(T)

cast to unqual type T

tryEx
template tryEx(Ex, alias func)

Tries to call function. On exception throws Ex, otherwise return func() result

Meta

License

Subject to the terms of the MIT license, as written in the included LICENSE file.

Authors

Zaramzan <shamyan.roman@gmail.com>, NCrashed <ncrashed@gmail.com>