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:
The Dlang Bot 2022-09-10 16:20:43 +02:00 committed by GitHub
commit e91bdf5969
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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`.