Skip to content

Commit 6315e8e

Browse files
committed
Not asyncio.run_asyncio, but trio_asyncio.run_asyncio
1 parent 9051214 commit 6315e8e

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

docs/source/usage.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ to this::
7676

7777
async def trio_main():
7878
async with trio_asyncio.open_loop() as loop:
79-
await trio.run_asyncio(async_main)
79+
await loop.run_asyncio(async_main)
8080

8181
def main():
8282
trio.run(trio_main)
@@ -205,18 +205,24 @@ Calling asyncio from Trio
205205
Pass the function and any arguments to ``loop.run_asyncio()``. This method
206206
conforms to Trio's standard task semantics.
207207

208+
:func:`trio_asyncio.run_asyncio` is a shortcut for
209+
``asyncio.get_event_loop().run_asyncio``.
210+
208211
::
209212

210213
async def some_asyncio_code(foo):
211214
await asyncio.sleep(1)
212215
return foo*20
213216
214-
res = await trio.run_asyncio(some_trio_code, 21)
217+
res = await trio_asyncio.run_asyncio(some_trio_code, 21)
215218
assert res == 420
216219

217220
.. autodoc: trio_asyncio.run_asyncio
218221
219-
If you already have a coroutine you need to await, call ``loop.run_coroutine()``:
222+
If you already have a coroutine you need to await, call ``loop.run_coroutine()``.
223+
224+
:func:`trio_asyncio.run_coroutine` is a shortcut for
225+
``asyncio.get_event_loop().run_coroutine``.
220226

221227
::
222228

0 commit comments

Comments
 (0)