mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 14:40:30 +03:00
Merge pull request #8563 from MartinNowak/merge_stable
merge stable Signed-off-by: Iain Buclaw <ibuclaw@users.noreply.github.com> Merged-on-behalf-of: Iain Buclaw <ibuclaw@users.noreply.github.com>
This commit is contained in:
commit
e91bdf5969
1 changed files with 40 additions and 0 deletions
|
@ -3793,7 +3793,27 @@ Params:
|
||||||
sink.formatValue(_value, fmt);
|
sink.formatValue(_value, fmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void toString()(scope void delegate(const(char)[]) sink, scope const ref FormatSpec!char fmt) const
|
||||||
|
{
|
||||||
|
if (isNull)
|
||||||
|
{
|
||||||
|
sink.formatValue("Nullable.null", fmt);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sink.formatValue(_value, fmt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@system unittest
|
||||||
|
{
|
||||||
|
import std.conv : to;
|
||||||
|
|
||||||
|
const Nullable!(ulong, 0) x = 1;
|
||||||
|
assert(x.to!string == "1");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check if `this` is in the null state.
|
Check if `this` is in the null state.
|
||||||
|
@ -4320,7 +4340,27 @@ Params:
|
||||||
sink.formatValue(*_value, fmt);
|
sink.formatValue(*_value, fmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void toString()(scope void delegate(const(char)[]) sink, scope const ref FormatSpec!char fmt) const
|
||||||
|
{
|
||||||
|
if (isNull)
|
||||||
|
{
|
||||||
|
sink.formatValue("Nullable.null", fmt);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sink.formatValue(*_value, fmt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@system unittest
|
||||||
|
{
|
||||||
|
import std.conv : to;
|
||||||
|
|
||||||
|
const NullableRef!(ulong) x = new ulong(1);
|
||||||
|
assert(x.to!string == "1");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Binds the internal state to `value`.
|
Binds the internal state to `value`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue