deprecate std.stream and friends

This commit is contained in:
Robert burner Schadek 2015-05-28 06:48:28 +02:00
parent a26c6c6b8d
commit 787637debd
5 changed files with 11 additions and 16 deletions

View file

@ -21,7 +21,7 @@
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt) * http://www.boost.org/LICENSE_1_0.txt)
*/ */
module std.cstream; deprecated module std.cstream;
public import core.stdc.stdio; public import core.stdc.stdio;
public import std.stream; public import std.stream;

View file

@ -167,7 +167,6 @@ import std.encoding;
import std.exception; import std.exception;
import std.regex; import std.regex;
import std.socket : InternetAddress; import std.socket : InternetAddress;
import std.stream;
import std.string; import std.string;
import std.traits; import std.traits;
import std.typecons; import std.typecons;
@ -291,9 +290,8 @@ void download(Conn = AutoProtocol)(const(char)[] url, string saveToPath, Conn co
static if (is(Conn : HTTP) || is(Conn : FTP)) static if (is(Conn : HTTP) || is(Conn : FTP))
{ {
conn.url = url; conn.url = url;
auto f = new std.stream.BufferedFile(saveToPath, FileMode.OutNew); auto f = File(saveToPath, "w");
scope (exit) f.close(); conn.onReceive = (ubyte[] data) { f.write(data); return data.length; };
conn.onReceive = (ubyte[] data) { return f.write(data); };
conn.perform(); conn.perform();
} }
else else
@ -351,13 +349,15 @@ void upload(Conn = AutoProtocol)(string loadFromPath, const(char)[] url, Conn co
static if (is(Conn : HTTP) || is(Conn : FTP)) static if (is(Conn : HTTP) || is(Conn : FTP))
{ {
auto f = new std.stream.BufferedFile(loadFromPath, FileMode.In); static import std.file;
scope (exit) f.close(); void[] f;
conn.onSend = (void[] data) conn.onSend = (void[] data)
{ {
return f.read(cast(ubyte[])data); f = std.file.read(loadFromPath);
return f.length;
}; };
conn.contentLength = cast(size_t)f.size; conn.contentLength = f.length;
conn.perform(); conn.perform();
} }
} }

View file

@ -37,7 +37,7 @@
* Macros: WIKI=Phobos/StdSocketstream * Macros: WIKI=Phobos/StdSocketstream
*/ */
module std.socketstream; deprecated module std.socketstream;
private import std.stream; private import std.stream;
private import std.socket; private import std.socket;

View file

@ -27,7 +27,7 @@
* "as is" without express or implied warranty. * "as is" without express or implied warranty.
*/ */
module std.stream; deprecated module std.stream;
import std.internal.cstring; import std.internal.cstring;

View file

@ -3011,11 +3011,6 @@ unittest
inout(Object) foo() inout; inout(Object) foo() inout;
} }
BlackHole!Foo o; BlackHole!Foo o;
// Bugzilla 12464
import std.stream;
import std.typecons;
BlackHole!OutputStream dout;
} }