NAME

Hyperman::Future - a fast, native, Future-compatible async result

SYNOPSIS

use Hyperman::Future;

my $f = Hyperman::Future->new;
$f->then(sub { my $v = shift; ... });
$f->done(42);

my $all = Hyperman::Future->needs_all($f1, $f2);

# inside a running Hyperman worker, awaiting pumps the loop:
my @row = $db_future->get;

DESCRIPTION

An asynchronous result object with an API compatible with CPAN Future: done/fail/cancel, on_ready/on_done/on_fail, then/else/ followed_by/transform, get/await, and the convergent combinators wait_all/wait_any/needs_all/needs_any.

The implementation is entirely XS over an array-slot object: creation, resolution, callback firing, chaining, and the combinators all run in C, with continuations as C closures trampolined through a fire queue - long then-chains run iteratively with bounded stack depth. Cancelling a future derived by then/followed_by/transform propagates the cancellation to its still-pending upstream.

get/await on a pending future inside a running Hyperman worker pump the worker's own event loop re-entrantly, servicing other connections meanwhile. Outside a Hyperman loop, an external loop may install $Hyperman::Future::AWAIT (a coderef receiving the future) to make awaiting work; without either, awaiting a pending future croaks.

as_cpan_future / from_future convert to and from CPAN Future objects when interop with isa('Future') code is needed. @ISA is deliberately not set to Future: inherited Future methods would operate on its hash-based internals, not this array-slot object.

AUTHOR

LNATION <email@lnation.org>

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION. This is free software, licensed under the Artistic License 2.0.