Files
adriadri6972 d3d9c5f833 upload project
2025-07-31 15:21:08 +02:00

21 lines
608 B
C#

using System.Runtime.CompilerServices;
namespace UnityEngine.XR.ARSubsystems
{
static class AwaitableUtils<T>
{
/// <summary>
/// An `Awaitable` equivalent to C#'s `Task.FromResult`.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static Awaitable<T> FromResult(
AwaitableCompletionSource<T> completionSource, T result)
{
var awaitable = completionSource.Awaitable;
completionSource.SetResult(result);
completionSource.Reset();
return awaitable;
}
}
}