summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/library/uasyncio.rst3
-rw-r--r--extmod/uasyncio/__init__.py2
-rw-r--r--extmod/uasyncio/stream.py5
3 files changed, 9 insertions, 1 deletions
diff --git a/docs/library/uasyncio.rst b/docs/library/uasyncio.rst
index ff3232ebd..c0d0e85d7 100644
--- a/docs/library/uasyncio.rst
+++ b/docs/library/uasyncio.rst
@@ -177,7 +177,8 @@ TCP stream connections
.. class:: Stream()
This represents a TCP stream connection. To minimise code this class implements
- both a reader and a writer.
+ both a reader and a writer, and both ``StreamReader`` and ``StreamWriter`` alias to
+ this class.
.. method:: Stream.get_extra_info(v)
diff --git a/extmod/uasyncio/__init__.py b/extmod/uasyncio/__init__.py
index 6bff13883..da8b58061 100644
--- a/extmod/uasyncio/__init__.py
+++ b/extmod/uasyncio/__init__.py
@@ -12,6 +12,8 @@ _attrs = {
"Lock": "lock",
"open_connection": "stream",
"start_server": "stream",
+ "StreamReader": "stream",
+ "StreamWriter": "stream",
}
# Lazy loader, effectively does:
diff --git a/extmod/uasyncio/stream.py b/extmod/uasyncio/stream.py
index 7803ac4bf..2a1efd1a1 100644
--- a/extmod/uasyncio/stream.py
+++ b/extmod/uasyncio/stream.py
@@ -53,6 +53,11 @@ class Stream:
self.out_buf = b""
+# Stream can be used for both reading and writing to save code size
+StreamReader = Stream
+StreamWriter = Stream
+
+
# Create a TCP stream connection to a remote host
async def open_connection(host, port):
from uerrno import EINPROGRESS