mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 14:40:30 +03:00
deprecate std.stream and friends
This commit is contained in:
parent
a26c6c6b8d
commit
787637debd
5 changed files with 11 additions and 16 deletions
|
@ -21,7 +21,7 @@
|
|||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
module std.cstream;
|
||||
deprecated module std.cstream;
|
||||
|
||||
public import core.stdc.stdio;
|
||||
public import std.stream;
|
||||
|
|
|
@ -167,7 +167,6 @@ import std.encoding;
|
|||
import std.exception;
|
||||
import std.regex;
|
||||
import std.socket : InternetAddress;
|
||||
import std.stream;
|
||||
import std.string;
|
||||
import std.traits;
|
||||
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))
|
||||
{
|
||||
conn.url = url;
|
||||
auto f = new std.stream.BufferedFile(saveToPath, FileMode.OutNew);
|
||||
scope (exit) f.close();
|
||||
conn.onReceive = (ubyte[] data) { return f.write(data); };
|
||||
auto f = File(saveToPath, "w");
|
||||
conn.onReceive = (ubyte[] data) { f.write(data); return data.length; };
|
||||
conn.perform();
|
||||
}
|
||||
else
|
||||
|
@ -351,13 +349,15 @@ void upload(Conn = AutoProtocol)(string loadFromPath, const(char)[] url, Conn co
|
|||
|
||||
static if (is(Conn : HTTP) || is(Conn : FTP))
|
||||
{
|
||||
auto f = new std.stream.BufferedFile(loadFromPath, FileMode.In);
|
||||
scope (exit) f.close();
|
||||
static import std.file;
|
||||
void[] f;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* Macros: WIKI=Phobos/StdSocketstream
|
||||
*/
|
||||
|
||||
module std.socketstream;
|
||||
deprecated module std.socketstream;
|
||||
|
||||
private import std.stream;
|
||||
private import std.socket;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
module std.stream;
|
||||
deprecated module std.stream;
|
||||
|
||||
|
||||
import std.internal.cstring;
|
||||
|
|
|
@ -3011,11 +3011,6 @@ unittest
|
|||
inout(Object) foo() inout;
|
||||
}
|
||||
BlackHole!Foo o;
|
||||
|
||||
// Bugzilla 12464
|
||||
import std.stream;
|
||||
import std.typecons;
|
||||
BlackHole!OutputStream dout;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue