using System; namespace Unity.VisualScripting.FullSerializer.Internal { /// /// Simple option type. This is akin to nullable types. /// public struct fsOption { private bool _hasValue; private T _value; public bool HasValue => _hasValue; public bool IsEmpty => _hasValue == false; public T Value { get { if (IsEmpty) { throw new InvalidOperationException("fsOption is empty"); } return _value; } } public fsOption(T value) { _hasValue = true; _value = value; } public static fsOption Empty; } public static class fsOption { public static fsOption Just(T value) { return new fsOption(value); } } }