www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Deprecation: std.stdio.File.ByChunkImpl is not visible

reply psyscout <oracle.gm gmail.com> writes:
Hi all,

I'm trying to resolve a Deprecation message. File.ByChunkImpl is 
private which cause a compiler message.

Any clue how to to deal with this?
(Deprecation: std.stdio.File.ByChunkImpl is not visible)

struct PutObjectRequest(Range)
	if (isInputRange!Range && is(ElementType!Range == ubyte[]))
{
	string bucket;
	string key;
	Range content;
	ulong content_size;
}

auto putObjectRequest(string bucket, string key, string file)
{
	import std.stdio : File;

	enum chunk_size = 16 * 1024; // 16 KiB
	auto file_ = File(file, "r");

	return PutObjectRequest!(File.ByChunkImpl)(bucket, key, 
file_.byChunk(chunk_size), file_.size);
}

Appreciate any help!
Thanks
Dec 23 2019
parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Tue, Dec 24, 2019 at 12:33:34AM +0000, psyscout via Digitalmars-d-learn
wrote:
[...]
 auto putObjectRequest(string bucket, string key, string file)
 {
 	import std.stdio : File;
 
 	enum chunk_size = 16 * 1024; // 16 KiB
 	auto file_ = File(file, "r");
 
 	return PutObjectRequest!(File.ByChunkImpl)(bucket, key,
 file_.byChunk(chunk_size), file_.size);
Hmm, try replacing the above line with: auto range = file_.byChunk(chunk_size); return PutObjectRequest!(typeof(range))(bucket, key, range, file_.size); T -- Never step over a puddle, always step around it. Chances are that whatever made it is still dripping.
Dec 23 2019
parent psyscout <oracle.gm gmail.com> writes:
Many thanks H. S. Teoh! It works!
Dec 24 2019