ensure 1.0.0

Fluent guards to aid in ensuring the correctness of function/method arguments.


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:

ensure

Fluent guards to aid in ensuring the correctness of function/method arguments. Inspired by the lovely Ensure.That library for C#.

Example

import std.string : chop;
import std.stdio : write, writefln, stdin;

import ensure;

void greet( string name )
{
    // String cannot be null, zero-length, or consist entirely of whitespace characters.
    ensure!name.isNotNull.isNotEmpty.isNotWhitespace;

    writefln( "Hello, %s!", name );
}

void main()
{
    write( "What is your name? " );
    auto name = stdin.readln().chop();
    greet( name );
}

Get it

It's on dub: https://code.dlang.org/packages/ensure

Authors:
  • Tony J. Hudgins
Dependencies:
none
Versions:
1.1.0 2019-Jun-28
1.0.0 2019-Jun-27
~master 2019-Jun-28
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 11 downloads total

Score:
0.5
Short URL:
ensure.dub.pm