CarryingFiber

A Fiber carrying a payload of type T.

Used interchangeably with Fiber, but allows for casting to true CarryingFiber!T-ness to access the payload member.

Constructors

this
this(Fn fn, Args args)

Constructor function merely taking a function/delegate pointer, to call when invoking this Fiber (via .call()).

this
this(T payload, Fn fn, Args args)

Constructor function taking a T payload to assign to its own internal this.payload, as well as a function/delegate pointer to call when invoking this Fiber (via .call()).

Members

Functions

resetPayload
void resetPayload()

Resets the payload to its initial value.

Variables

payload
T payload;

Embedded payload value in this Fiber; what distinguishes it from plain Fibers.

Parameters

T

Type to embed into the class as the type of CarryingFiber.payload.

Examples

void dg()
{
    CarryingFiber!bool fiber = cast(CarryingFiber!bool)(Fiber.getThis);
    assert(fiber !is null);  // Correct cast

    assert(fiber.payload);
    Fiber.yield();
    assert(!fiber.payload);
}

auto fiber = new CarryingFiber!bool(true, &dg, BufferSize.fiberStack);
fiber.call();
fiber.payload = false;
fiber.call();

Meta