Add stream proxy types to allow user code to store generic streams.

This commit is contained in:
Sönke Ludwig 2017-01-31 16:48:04 +01:00
parent dae1ca71b5
commit df4022d83e
No known key found for this signature in database
GPG key ID: D95E8DB493EE314C

View file

@ -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`