diff --git a/src/Result.cs b/src/Result.cs index 625f973..c80c76d 100644 --- a/src/Result.cs +++ b/src/Result.cs @@ -5,11 +5,33 @@ namespace UnmanagedResult; -public struct Result : IResult> +public readonly struct Result : IResult> where TValue : unmanaged - where TEnum : unmanaged, Enum + where TEnum : unmanaged, Enum { - public TValue Value => throw new System.NotImplementedException(); + private readonly byte _flags; + private readonly TValue _value; + private readonly Error _error; - public Error Error => default; + public Result(TValue value) + { + _value = value; + _flags = 0; + } + + public Result(Error error) + { + _error = error; + _flags = 1; + } + + public static bool operator true(Result result) + { + return result._flags is 0; + } + + public static bool operator false(Result result) + { + return result._flags is not 0; + } } \ No newline at end of file