- back
auto ref back [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
- data
auto data [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
- empty
auto empty [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
- front
auto ref front [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
- length
auto length [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
- opDollar
auto opDollar [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
- opIndex
size_t opIndex [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
- popBack
void popBack [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
- popBackN
size_t popBackN [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
- popFront
void popFront [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
- popFrontN
size_t popFrontN [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
- save
auto save [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
static assert(isInputRange!(Buffer!ubyte));
static assert(isForwardRange!(Buffer!ubyte));
static assert(hasLength!(Buffer!ubyte));
static assert(hasSlicing!(Buffer!ubyte));
static assert(isBidirectionalRange!(Buffer!ubyte));
static assert(isRandomAccessRange!(Buffer!ubyte));
auto b = Buffer!ubyte();
b.put("abc".representation.dup);
b.put("def".representation.dup);
assert(b.length == 6);
assert(b.toString == "abcdef");
assert(b.front == 'a');
assert(b.back == 'f');
assert(equal(b[0..$], "abcdef"));
assert(equal(b[$-2..$], "ef"));
assert(b == "abcdef");
b.popFront;
b.popBack;
assert(b.front == 'b');
assert(b.back == 'e');
assert(b.length == 4);
assert(retro(b).front == 'e');
assert(countUntil(b, 'e') == 3);
assert(equal(splitter(b, 'c').array[1], ['d', 'e'])); // split "bcde" on 'c'
assert(equal(b, "bcde"));
b.popFront; b.popFront;
assert(b.front == 'd');
assert(b.front == b[0]);
assert(b.back == b[$-1]);
auto c = Buffer!ubyte();
c.put("Header0: value0\n".representation.dup);
c.put("Header1: value1\n".representation.dup);
c.put("Header2: value2\n\nbody".representation.dup);
auto c_length = c.length;
auto eoh = countUntil(c, "\n\n");
assert(eoh == 47);
foreach(header; c[0..eoh].splitter('\n') ) {
writeln(castFrom!(ubyte[]).to!(string)(header.data));
}
assert(equal(findSplit(c, "\n\n")[2], "body"));
assert(c.length == c_length);
Buffer used to collect and process data from network. It remainds Appender, but support also Range interface.
To place data in buffer use put() method.
To retrieve data from buffer you can use several methods: