From df4022d83eb1e891b73731288b10db5881c72b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Tue, 31 Jan 2017 16:48:04 +0100 Subject: [PATCH] Add stream proxy types to allow user code to store generic streams. --- source/vibe/core/stream.d | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/vibe/core/stream.d b/source/vibe/core/stream.d index cd8331a..12b79f1 100644 --- a/source/vibe/core/stream.d +++ b/source/vibe/core/stream.d @@ -17,6 +17,7 @@ module vibe.core.stream; import vibe.internal.traits : checkInterfaceConformance, validateInterfaceConformance; +import vibe.internal.interfaceproxy; import core.time; import std.algorithm; import std.conv; @@ -275,6 +276,19 @@ final class NullOutputStream : OutputStream { void finalize() {} } + +/// Generic storage for types that implement the `InputStream` interface +alias InputStreamProxy = InterfaceProxy!InputStream; +/// Generic storage for types that implement the `OutputStream` interface +alias OutputStreamProxy = InterfaceProxy!OutputStream; +/// Generic storage for types that implement the `Stream` interface +alias StreamProxy = InterfaceProxy!Stream; +/// Generic storage for types that implement the `ConnectionStream` interface +alias ConnectionStreamProxy = InterfaceProxy!ConnectionStream; +/// Generic storage for types that implement the `RandomAccessStream` interface +alias RandomAccessStreamProxy = InterfaceProxy!RandomAccessStream; + + /** Tests if the given aggregate type is a valid input stream. See_also: `validateInputStream`