scoped2.dhover×137all
// Clay's open/close, in D: `with (ui.column(...)) { children }` closes in a destructor.
struct 
(struct) scoped2.Env
Env
{ bool
(field) bool scoped2.Env.compact
compact
; }
private struct
(struct) scoped2.NamedOnly
NamedOnly
{}
struct
(struct) scoped2.Ui
Ui
{ uint
(field) uint scoped2.Ui.depth
depth
; uint
(field) uint scoped2.Ui.count
count
;
(struct) scoped2.Env
Env
(field) scoped2.Env scoped2.Ui.env
env
;
char[512]
(field) char[512] scoped2.Ui.log
log
; uint
(field) uint scoped2.Ui.logLen
logLen
;
void
void scoped2.Ui.note(string s) pure nothrow @nogc @safe
note
(
(alias) object.string = string
string
(parameter) string s
s
) @safe pure nothrow @nogc {
(field) char[512] scoped2.Ui.log
log
[
(field) uint scoped2.Ui.logLen
logLen
..
(field) uint scoped2.Ui.logLen
logLen
+
(parameter) string s
s
.
(field) ulong string.length
length
] =
(parameter) string s
s
;
(field) uint scoped2.Ui.logLen
logLen
+= cast(uint)
(parameter) string s
s
.
(field) ulong string.length
length
; }
} /// The open element. It holds nothing a `with` body could name by accident. struct
(struct) scoped2.Opened

The open element. It holds nothing a with body could name by accident.

Opened
{ private
(struct) scoped2.Ui
Ui
*
(field) scoped2.Ui* scoped2.Opened.owner
owner
;
private
(struct) scoped2.Env
Env
(field) scoped2.Env scoped2.Opened.saved
saved
;
@disable this(this); ~this() scope @safe pure nothrow @nogc { if (
(field) scoped2.Ui* scoped2.Opened.owner
owner
is null) return;
(field) scoped2.Ui* scoped2.Opened.owner
owner
.
(field) uint scoped2.Ui.depth
depth
--; // close: pop, compute the fit size from the children here
(field) scoped2.Ui* scoped2.Opened.owner
owner
.
(field) scoped2.Env scoped2.Ui.env
env
=
(field) scoped2.Env scoped2.Opened.saved
saved
; // context pops with the element
(field) scoped2.Ui* scoped2.Opened.owner
owner
.
void scoped2.Ui.note(string s) pure nothrow @nogc @safe
note
(")");
} }
(struct) scoped2.Opened

The open element. It holds nothing a with body could name by accident.

Opened
scoped2.Opened scoped2.column(return ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), int gap = 0, bool compact = false, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @trusted
column
(return ref
(struct) scoped2.Ui
Ui
(parameter) scoped2.Ui ui
ui
,
(struct) scoped2.NamedOnly
NamedOnly
(parameter) scoped2.NamedOnly _
_
=
(struct) scoped2.NamedOnly
NamedOnly
.
(constant) scoped2.NamedOnly scoped2.NamedOnly.init = NamedOnly()
init
, int
(parameter) int gap
gap
= 0, bool
(parameter) bool compact
compact
= false,
(alias) object.size_t = ulong
size_t
(parameter) ulong line
line
= __LINE__) @trusted pure nothrow @nogc
{
(parameter) scoped2.Ui ui
ui
.
(field) uint scoped2.Ui.count
count
++;
(parameter) scoped2.Ui ui
ui
.
(field) uint scoped2.Ui.depth
depth
++;
const
(local variable) const(scoped2.Env) saved
saved
=
(parameter) scoped2.Ui ui
ui
.
(field) scoped2.Env scoped2.Ui.env
env
;
if (
(parameter) bool compact
compact
)
(parameter) scoped2.Ui ui
ui
.
(field) scoped2.Env scoped2.Ui.env
env
.
(field) bool scoped2.Env.compact
compact
= true; // known before any child is built
(parameter) scoped2.Ui ui
ui
.
void scoped2.Ui.note(string s) pure nothrow @nogc @safe
note
("(");
return
(struct) scoped2.Opened

The open element. It holds nothing a with body could name by accident.

Opened
(&
(parameter) scoped2.Ui ui
ui
,
(local variable) const(scoped2.Env) saved
saved
);
} void
void scoped2.label(ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), string text = null, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @safe
label
(ref
(struct) scoped2.Ui
Ui
(parameter) scoped2.Ui ui
ui
,
(struct) scoped2.NamedOnly
NamedOnly
(parameter) scoped2.NamedOnly _
_
=
(struct) scoped2.NamedOnly
NamedOnly
.
(constant) scoped2.NamedOnly scoped2.NamedOnly.init = NamedOnly()
init
,
(alias) object.string = string
string
(parameter) string text
text
= null,
(alias) object.size_t = ulong
size_t
(parameter) ulong line
line
= __LINE__)
@safe pure nothrow @nogc {
(parameter) scoped2.Ui ui
ui
.
(field) uint scoped2.Ui.count
count
++;
(parameter) scoped2.Ui ui
ui
.
void scoped2.Ui.note(string s) pure nothrow @nogc @safe
note
(
(parameter) scoped2.Ui ui
ui
.
(field) scoped2.Env scoped2.Ui.env
env
.
(field) bool scoped2.Env.compact
compact
? "c" : "L");
} void
void scoped2.pane(ref scoped2.Ui ui, bool computing, in int[] rows) pure nothrow @nogc @safe
pane
(ref
(struct) scoped2.Ui
Ui
(parameter) scoped2.Ui ui
ui
, bool
(parameter) bool computing
computing
, in int[]
(parameter) const(int[]) rows
rows
) @safe pure nothrow @nogc
{ with (
(parameter) scoped2.Ui ui
ui
.
scoped2.Opened scoped2.column(return ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), int gap = 0, bool compact = false, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @trusted
column
(gap: 1))
{
(parameter) scoped2.Ui ui
ui
.
void scoped2.label(ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), string text = null, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @safe
label
(text: "Stats");
if (
(parameter) bool computing
computing
)
(parameter) scoped2.Ui ui
ui
.
void scoped2.label(ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), string text = null, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @safe
label
(text: "computing…");
foreach (
(parameter) const(int) r
r
;
(parameter) const(int[]) rows
rows
)
(parameter) scoped2.Ui ui
ui
.
void scoped2.label(ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), string text = null, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @safe
label
(text: "row");
with (
(parameter) scoped2.Ui ui
ui
.
scoped2.Opened scoped2.column(return ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), int gap = 0, bool compact = false, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @trusted
column
(compact: true))
{
(parameter) scoped2.Ui ui
ui
.
void scoped2.label(ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), string text = null, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @safe
label
(text: "inside");
if (
(parameter) const(int[]) rows
rows
.
(field) ulong const(int[]).length
length
> 1)
return; // early exit still closes both elements
(parameter) scoped2.Ui ui
ui
.
void scoped2.label(ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), string text = null, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @safe
label
(text: "never");
}
(parameter) scoped2.Ui ui
ui
.
void scoped2.label(ref scoped2.Ui ui, scoped2.NamedOnly _ = NamedOnly(), string text = null, ulong line = cast(ulong)__LINE__) pure nothrow @nogc @safe
label
(text: "after");
} } void
void D main() @system
main
() @system
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio is publically imported when importing std.stdio.

There are three layers of I/O:

  1. The lowest layer is the operating system layer. The two main schemes are Windows and Posix.

  2. C's stdio.h which unifies the two operating system schemes.

  3. std.stdio, this module, unifies the various stdio.h implementations into a high level package for D programs.

Source

std/stdio.d

@copyrightCopyright The D Language Foundation 2007-.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Alex Rønne Petersen
stdio
:
(alias template) writeln = std.stdio.writeln(T...)(T args)

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Params: args = the items to write to stdout

Throws: In case of an I/O error, throws an $(LREF StdioException). Example: Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main() { string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }

} ---

writeln
;
(struct) scoped2.Ui
Ui
(local variable) scoped2.Ui ui
ui
;
static immutable int[2]
(immutable global) immutable(int[2]) scoped2.main.rows
rows
= [1, 2];
void scoped2.pane(ref scoped2.Ui ui, bool computing, in int[] rows) pure nothrow @nogc @safe
pane
(
(local variable) scoped2.Ui ui
ui
, true,
(immutable global) immutable(int[2]) scoped2.main.rows
rows
[]);
void std.stdio.writeln!(char[], string, uint)(char[] __param_0, string __param_1, uint __param_2) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
(local variable) scoped2.Ui ui
ui
.
(field) char[512] scoped2.Ui.log
log
[0 ..
(local variable) scoped2.Ui ui
ui
.
(field) uint scoped2.Ui.logLen
logLen
], " depth after: ",
(local variable) scoped2.Ui ui
ui
.
(field) uint scoped2.Ui.depth
depth
);
(local variable) scoped2.Ui ui
ui
=
(struct) scoped2.Ui
Ui
.
(constant) scoped2.Ui scoped2.Ui.init = Ui(0u, 0u, Env(false), ['\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff', '\xff'], 0u)
init
;
void scoped2.pane(ref scoped2.Ui ui, bool computing, in int[] rows) pure nothrow @nogc @safe
pane
(
(local variable) scoped2.Ui ui
ui
, false,
(immutable global) immutable(int[2]) scoped2.main.rows
rows
[0 .. 1]);
void std.stdio.writeln!(char[], string, uint)(char[] __param_0, string __param_1, uint __param_2) @safe

Equivalent to write(args, '\n'). Calling writeln without arguments is valid and just prints a newline to the standard output.

Example

Reads stdin and writes it to stdout with an argument counter.

import std.stdio;

void main()
{
    string line;

    for (size_t count = 0; (line = readln) !is null; count++)
    {
         writeln("Input ", count, ": ", line);
    }
}
@paramargs the items to write to stdout@throwsIn case of an I/O error, throws an StdioException.
writeln
(
(local variable) scoped2.Ui ui
ui
.
(field) char[512] scoped2.Ui.log
log
[0 ..
(local variable) scoped2.Ui ui
ui
.
(field) uint scoped2.Ui.logLen
logLen
], " depth after: ",
(local variable) scoped2.Ui ui
ui
.
(field) uint scoped2.Ui.depth
depth
);
}