asyncanything

make anything async [to be honest, fake async]

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:25

Installation

nimble install asyncanything
choosenim install asyncanything
git clone https://github.com/hamidb80/asyncanything

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
asyncanything - - - - - - -

Source

Repository https://github.com/hamidb80/asyncanything
Homepage https://github.com/hamidb80/asyncanything
Registry Source nimble_official

README

make anything async with AsyncAnything!

imagine you have a heavy function in the main Event-Loop

proc AssumeItsHugeAmountOfWork(a: int): int=
  sleep 1000 * 10
  return a + 1

with this small library you can pass it to another thread and fake it as a async function! Wow you're a genius!

let b = goAsync AssumeItsHugeAmountOfWork()
# or
let b = |>AssumeItsHugeAmountOfWork()

the idea is that you pass it to another thread and you check it every timeout milliseconds. you can pass the timeout like this:

let b = goAsync(AssumeItsHugeAmountOfWork(), 100)

but by default it's value is fakeAsyncTimeout which is 100. you can also change it's value at the compile time with -d:fakeAsyncTimeout=<N> to your ideal timeout [ here <N> is an integer ]

limitations

there are some limitation when you want to run a non-return closure proc.