extmod/uasyncio: Add readinto() method to Stream class.

With docs and a multi-test using TCP server/client.

This method is a MicroPython extension, although there is discussion of
adding it to CPython: https://bugs.python.org/issue41305

Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
This commit is contained in:
Mike Teachman
2021-06-03 09:43:56 -07:00
committed by Damien George
parent 95048129b1
commit b0b8ebc4f6
4 changed files with 103 additions and 0 deletions

View File

@@ -240,6 +240,14 @@ TCP stream connections
This is a coroutine.
.. method:: Stream.readinto(buf)
Read up to n bytes into *buf* with n being equal to the length of *buf*.
Return the number of bytes read into *buf*.
This is a coroutine, and a MicroPython extension.
.. method:: Stream.readline()
Read a line and return it.