chore: renamed task completion status names
This commit is contained in:
@@ -4,20 +4,20 @@ using static Engine.Core.WaitForTaskYield;
|
|||||||
|
|
||||||
namespace Engine.Core;
|
namespace Engine.Core;
|
||||||
|
|
||||||
public class WaitForTaskYield(Task task, TaskCompletionStatus completionStatus = TaskCompletionStatus.Either) : ICoroutineYield
|
public class WaitForTaskYield(Task task, TaskCompletionStatus completionStatus = TaskCompletionStatus.Any) : ICoroutineYield
|
||||||
{
|
{
|
||||||
public bool Yield()
|
public bool Yield()
|
||||||
{
|
{
|
||||||
switch (completionStatus)
|
switch (completionStatus)
|
||||||
{
|
{
|
||||||
case TaskCompletionStatus.Successful:
|
case TaskCompletionStatus.Success:
|
||||||
if (task.IsCanceled)
|
if (task.IsCanceled)
|
||||||
throw new("Task has been canceled.");
|
throw new("Task has been canceled.");
|
||||||
if (task.IsFaulted)
|
if (task.IsFaulted)
|
||||||
throw task.Exception ?? new("Task has faulted.");
|
throw task.Exception ?? new("Task has faulted.");
|
||||||
return !task.IsCompletedSuccessfully;
|
return !task.IsCompletedSuccessfully;
|
||||||
|
|
||||||
case TaskCompletionStatus.Failed:
|
case TaskCompletionStatus.Fail:
|
||||||
if (task.IsCompletedSuccessfully)
|
if (task.IsCompletedSuccessfully)
|
||||||
throw new("Task was completed successfully.");
|
throw new("Task was completed successfully.");
|
||||||
return !task.IsFaulted;
|
return !task.IsFaulted;
|
||||||
@@ -28,8 +28,8 @@ public class WaitForTaskYield(Task task, TaskCompletionStatus completionStatus =
|
|||||||
|
|
||||||
public enum TaskCompletionStatus
|
public enum TaskCompletionStatus
|
||||||
{
|
{
|
||||||
Either,
|
Any,
|
||||||
Successful,
|
Success,
|
||||||
Failed
|
Fail
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user