Vixen
02b45cc4
csharp
public readonly struct CoroutineAwaitable

One suspension of a coroutine — everything await NextFrame() and its siblings produce.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Its own awaiter, which is why GetAwaiter returns itself. A separate awaiter type would be a second struct copied into the state machine for no gain; the compiler is happy with one as long as it has both halves.

IsCompleted is always . A coroutine never resumes inside the frame it suspended in, even for await Seconds(0f) — a zero wait that completed synchronously would turn while (true) await Seconds(0f); into a hang rather than a loop, and users write that. The single exception is Immediate, which still suspends here and is merely made ready by the very next drain.

Fields and properties (1)

  • public bool IsCompleted

    Always : awaiting one of these always yields.

Methods (9)

  • public CoroutineAwaitable GetAwaiter()

    Makes this awaitable.

  • public void OnCompleted(Action continuation)

    Schedules the continuation action that's invoked when the instance completes.

  • public void UnsafeOnCompleted(Action continuation)

    Schedules the continuation action that's invoked when the instance completes.

  • public void GetResult()

    Resumes the coroutine, or cancels it.

  • public bool Equals(CoroutineAwaitable other)

    Indicates whether the current object is equal to another object of the same type.

  • public override bool Equals(object? obj)

    Indicates whether this instance and a specified object are equal.

  • public override int GetHashCode()

    Returns the hash code for this instance.

  • public static bool operator ==(CoroutineAwaitable left, CoroutineAwaitable right)

    Compares two waits.

  • public static bool operator !=(CoroutineAwaitable left, CoroutineAwaitable right)

    Compares two waits.

Used by (3)

  • BehaviorVixen.Engine
  • CoroutineSchedulerVixen.Engine
  • CoroutineTestsVixen.Engine.Tests