Unstable 0.17.1.0

This commit is contained in:
Markus Isberg
2022-03-17 01:25:04 +09:00
parent 3974067915
commit 6d410cc1b7
302 changed files with 5878 additions and 3317 deletions
@@ -1,3 +1,5 @@
using System;
namespace Barotrauma
{
/// <summary>
@@ -10,5 +12,15 @@ namespace Barotrauma
{
public static Option<T> Some(T value) => Some<T>.Create(value);
public static Option<T> None() => None<T>.Create();
public bool IsNone() => this is None<T>;
public bool IsSome() => this is Some<T>;
public Option<TType> Select<TType>(Func<T, TType> selector) =>
this switch
{
Some<T> { Value: var value } => Option<TType>.Some(selector.Invoke(value)),
None<T> _ => Option<TType>.None(),
_ => throw new ArgumentOutOfRangeException()
};
}
}