BREAKING CHANGE: feat: use record struct

This commit is contained in:
Kyle Ratti 2024-04-30 13:17:02 -04:00
parent 07c89cade3
commit 68f527ec99
No known key found for this signature in database
GPG Key ID: 4D429B6287C68DD9

View File

@ -9,12 +9,12 @@ public static class Maybe
public static Maybe<T> Empty<T>() => new(val: default!, hasValue: false); public static Maybe<T> Empty<T>() => new(val: default!, hasValue: false);
} }
public readonly struct Maybe<T> public readonly record struct Maybe<T>
{ {
private readonly T _value; private readonly T _value;
public readonly bool HasValue; public readonly bool HasValue;
internal Maybe(T val = default!, bool hasValue = true) internal Maybe(T val, bool hasValue)
{ {
_value = val; _value = val;
HasValue = hasValue; HasValue = hasValue;