mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 06:00:35 +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,8 +3793,28 @@ Params:
|
|||
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.
|
||||
|
||||
|
@ -4320,8 +4340,28 @@ Params:
|
|||
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`.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue