/** * Converts a synchronous task to a synchronous generator. * * @param task - The synchronous task to convert. * @returns The converted synchronous generator. * @typeParam R - The return type of the task. */ declare function $resultToGenerator(resultOrPromiseResult: R): Generator, Exclude>; /** * Converts a promise task to an asynchronous generator. * * @param task - The promise task to convert. * @returns The converted asynchronous generator. * @typeParam R - The return type of the task. */ declare function $resultToGenerator(resultOrPromiseResult: Promise): AsyncGenerator, Exclude>; /** * Allows to compose tasks by mimicking the "try" operator in zig. A * synchronous generator function enable this composition by providing a "$try" * function that can be used to yield the result of a task. If the task returns * an error, the generator will stop the execution and return the error, * otherwise it will continue the execution with the result of the task. * * @param generator - The generator to execute. * @returns The result of the generator. * @typeParam T - The type of the successful result. * @typeParam E - The type of the error result. */ export declare function $macro($generator: ($try: typeof $resultToGenerator) => Generator): T | E; /** * Allows to compose tasks by mimicking the "try" operator in zig. An * asynchronous generator function enable this composition by providing a "$try" * function that can be used to yield the result of a task. If the task returns * an error, the generator will stop the execution and return the error, * otherwise it will continue the execution with the result of the task. * * @param generator - The generator to execute. * @returns The result of the generator. * @typeParam T - The type of the successful result. * @typeParam E - The type of the error result. */ export declare function $macro($generator: ($try: typeof $resultToGenerator) => AsyncGenerator): Promise; export {};