Re: iopipe: Writing output to std.io File

2020-01-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/30/20 12:59 AM, Jesse Phillips wrote: On Tuesday, 28 January 2020 at 16:09:55 UTC, Steven Schveighoffer wrote: Everything is pulled with iopipe, even output, so it's just a matter of who is pulling and when. Pushing is a matter of telling the other end to pull. That statement I think

Re: iopipe: Writing output to std.io File

2020-01-29 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 28 January 2020 at 16:09:55 UTC, Steven Schveighoffer wrote: Everything is pulled with iopipe, even output, so it's just a matter of who is pulling and when. Pushing is a matter of telling the other end to pull. -Steve That statement I think will be very helpful to me. The pus

Re: iopipe: Writing output to std.io File

2020-01-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/28/20 1:25 AM, Jesse Phillips wrote: I really feel like this is all very well thought out and clean, I don't appear to have a previous model to help visualize this output approach. Right now something like tee is coming to mind. Thank you for explaining with the answer. Thanks! Tee is a

Re: iopipe: Writing output to std.io File

2020-01-27 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 27 January 2020 at 18:12:40 UTC, Steven Schveighoffer wrote: Before I show you what to do, let me explain what the above actually does. 1. You constructed a buffer of characters. Good, this is the first step. 2. You used encodeText to convert the data to ubyte. Note that for char b

Re: iopipe: Writing output to std.io File

2020-01-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/27/20 1:12 PM, Steven Schveighoffer wrote: void writeln(Pipe)(ref Pipe sink, string text) {    enforce(sink.ensureElems(text.size) >= text.length); // make sure there's enough buffer space to hold the text    sink[0 .. text.length] = text; // write to the buffer    sink.release(text.le

Re: iopipe: Writing output to std.io File

2020-01-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/26/20 11:59 PM, Jesse Phillips wrote: On Monday, 27 January 2020 at 01:50:00 UTC, Jesse Phillips wrote: Just as I'm hitting send the part I'm missing clicked: I needed to add the text encoding because my buffer is `char` but File writes `ubyte` ```dlang     auto output() {     retur

Re: iopipe: Writing output to std.io File

2020-01-26 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 27 January 2020 at 01:50:00 UTC, Jesse Phillips wrote: Just as I'm hitting send the part I'm missing clicked: I needed to add the text encoding because my buffer is `char` but File writes `ubyte` ```dlang auto output() { return std.io.File("somefile.txt", mode!"w").refC

Re: iopipe: Writing output to std.io File

2020-01-26 Thread Jesse Phillips via Digitalmars-d-learn
Just as I'm hitting send the part I'm missing clicked: I needed to add the text encoding because my buffer is `char` but File writes `ubyte` ```dlang /+ dub.sdl: name "iobuftofile" dependency "iopipe" version="~>0.1.7" dependency "io" version="~>0.2.4" +/ void main() { import

iopipe: Writing output to std.io File

2020-01-26 Thread Jesse Phillips via Digitalmars-d-learn
I'd like to start utilizing IOPipe[1] more. Right now I have an interest in utilizing it for buffering output (actually I don't have a need for buffering, I just want to utilize iopipe) Looking through some different examples[2][3] I thought I would have something with this: ```dlang /+ dub.