buffered
import std::io::buffered; · source
The three blocking adapters here borrow the inner reader or writer through a pointer. You keep ownership of the underlying sink and remain responsible for dropping it; wrapping and unwrapping are free. The default buffer is DEFAULT_BUFFER_SIZE, 8 KiB, matching stdio's block-buffered default on most Unixes.
Types
BufferedWriter<W>
type struct BufferedWriter<W> where W: Write {
private writer: mut &W;
private buffer: mut u8*;
private capacity: i64;
private length: i64;
}
Wrapping a sink in a BufferedWriter coalesces many small writes into one syscall per buffer-full.
import std::io::buffered::{ BufferedWriter };
import std::io::stdio::{ Stdout, stdout };
const payload: Str = "hello\n";
mut out: Stdout = stdout();
mut buffered: BufferedWriter<Stdout> = BufferedWriter::new(&out);
buffered.write(payload)?;
buffered.flush()?;
buffered() reports how much is waiting, capacity() the buffer's size, and clear() discards the waiting bytes without writing them (for error paths). If you write through get_reference(), flush first — otherwise buffered bytes land out of order.
Dropping a
BufferedWriterflushes pending bytes, so let it go out of scope (ormem::dropit) before the wrapped sink does, or buffered writes are lost.
Constructors
static new(writer: mut &W) -> BufferedWriter<W> where W: Write;
static new(writer: mut &W) -> BufferedWriter<W> where W: Write;Wrap writer with a DEFAULT_BUFFER_SIZE-byte buffer. Panics on allocation failure.
static with_capacity(writer: mut &W, capacity: i64) -> BufferedWriter<W> where W: Write;
static with_capacity(writer: mut &W, capacity: i64) -> BufferedWriter<W> where W: Write;Wrap with an explicit buffer size. A capacity of zero or less is permitted but degenerate: no buffer is allocated and every write hits the sink directly. Panics on allocation failure.
Methods
get_reference(&this) -> &W;
get_reference(&this) -> &W;Borrow the inner writer. Useful for operations that bypass buffering (e.g., a direct flush on the underlying fd). Callers mutating through this must call BufferedWriter::flush first, or buffered bytes will land out of order.
buffered(&this) -> i64;
buffered(&this) -> i64;Number of bytes currently buffered but not yet flushed.
![inline]capacity(&this) -> i64;
![inline]capacity(&this) -> i64;The size of the write buffer in bytes.
clear(mut &this) -> void;
clear(mut &this) -> void;Discard buffered bytes without writing them. Useful on error paths where the caller knows the output is garbage.
LineWriter<W>
type struct LineWriter<W> {
private inner: BufferedWriter<W>;
}
A BufferedWriter that flushes after any write containing \n. The right choice for interactive stdout on a terminal, where a prompt has to appear before the read that follows it.
Constructors
static new(writer: mut &W) -> LineWriter<W> where W: Write;
static new(writer: mut &W) -> LineWriter<W> where W: Write;A writer over writer that flushes at the end of every line, with a buffer of the default size. writer must outlive it.
static with_capacity(writer: mut &W, capacity: i64) -> LineWriter<W> where W: Write;
static with_capacity(writer: mut &W, capacity: i64) -> LineWriter<W> where W: Write;As new, with a buffer of capacity bytes.
Methods
get_reference(&this) -> &W;
get_reference(&this) -> &W;The writer underneath; flush this one first before writing to it, or buffered bytes land out of order.
BufferedReader<R>
type struct BufferedReader<R> where R: Read {
private reader: mut &R;
private buffer: mut u8*;
private capacity: i64;
private position: i64;
private filled: i64;
}
Pulls in buffer-sized chunks and serves reads from memory, and overrides read_line with a scan-and-copy fast path — the byte-at-a-time default on the trait is exact but slow on a socket or a file.
lines() consumes the reader and iterates the rest of the source one line at a time. Each item is a Result<String, IoError> holding the line without its \n or \r\n; a last line with no line ending is still a line, and a line that is not UTF-8 is an InvalidData error, after which the next line reads as usual.
import std::fmt;
import std::fs::file::{ File };
import std::io::buffered::{ BufferedReader };
mut file: File = File::open("notes.txt")?;
for (line in BufferedReader::new(&file).lines()) {
const text: String = line?;
fmt::println(f"{text.as_str()}");
}
It also exposes the zero-copy parsing pair: fill_buffer() returns the filled region as a &Slice<u8> (empty at EOF), and consume(amount) advances past however many bytes you actually wanted. available() reports what is buffered and unread.
Constructors
static new(reader: mut &R) -> BufferedReader<R> where R: Read;
static new(reader: mut &R) -> BufferedReader<R> where R: Read;A reader that fills a buffer of the default size from reader, which must outlive it.
static with_capacity(reader: mut &R, capacity: i64) -> BufferedReader<R> where R: Read;
static with_capacity(reader: mut &R, capacity: i64) -> BufferedReader<R> where R: Read;A reader with a buffer of capacity bytes. Panics when capacity is not positive.
Methods
get_reference(&this) -> &R;
get_reference(&this) -> &R;The reader underneath. Reading from it directly skips the bytes this BufferedReader has already buffered.
![inline]capacity(&this) -> i64;
![inline]capacity(&this) -> i64;The size of the read buffer in bytes.
available(&this) -> i64;
available(&this) -> i64;Bytes currently buffered and unread.
consume(mut &this, amount: i64) -> void;
consume(mut &this, amount: i64) -> void;Advance the buffer cursor past amount bytes. amount must not exceed available(); a larger value is a caller bug, and a negative one panics "out of range".
fill_buffer(mut &this) -> Result<&Slice<u8>, IoError>;
fill_buffer(mut &this) -> Result<&Slice<u8>, IoError>;Fill the buffer from the source if empty, then surface the filled region. Returns an empty slice at EOF. Paired with consume for zero-copy parsing: read a prefix, decide how many bytes are actually wanted, consume that many.
lines(this) -> Lines<R>;
lines(this) -> Lines<R>;The rest of the source, one line at a time: each item is an owned String without its \n or \r\n, or the error that stopped the reading. A last line with no line ending is still a line.
Lines<R>
type struct Lines<R> where R: Read {}
The iterator BufferedReader.lines() returns.
Trait implementations
BufferedWriter
implement<W> trait Write for struct BufferedWriter<W> where W: Write
implement<W> trait Drop for struct BufferedWriter<W>
LineWriter
implement<W> trait Write for struct LineWriter<W> where W: Write
implement<W> trait Drop for struct LineWriter<W>
BufferedReader
implement<R> trait Read for struct BufferedReader<R> where R: Read
implement<R> trait Drop for struct BufferedReader<R>
Lines
implement<R> trait Iterator<Result<String, IoError>> for struct Lines<R> where R: Read
BufferedStream<S>
type struct BufferedStream<S> {
private inner: S;
private rbuf: Array<u8>;
private rpos: i64;
private scratch: Array<u8>;
private wbuf: Array<u8>;
}
The non-blocking counterpart, implementing AsyncRead and AsyncWrite over any AsyncTransport. Unlike the adapters above it owns its transport, because a borrowed transport cannot be held across a suspension point. of(inner) wraps an already-connected transport, and transport() surfaces it for socket options or a negotiated ALPN protocol — not for reading or writing, which would desynchronize the buffers. A fill first drops the consumed prefix of the read buffer, so a long-lived connection's buffer tracks what is live rather than everything ever read.
net::http::connection and net::ws::frame extend it with protocol readers as inherent methods; see connection for why they are methods rather than free functions.
Constructors
static of(inner: S) -> BufferedStream<S>;
static of(inner: S) -> BufferedStream<S>;Wrap an already-connected transport.
Methods
transport(mut &this) -> mut S*;
transport(mut &this) -> mut S*;The transport, for callers that need it directly (socket options, the negotiated ALPN protocol). Not for reading or writing — that would desynchronize the buffers.
Trait implementations
implement<S> trait AsyncRead for struct BufferedStream<S>
implement<S> trait AsyncWrite for struct BufferedStream<S>
implement<S> trait Drop for struct BufferedStream<S>
Constants
const DEFAULT_BUFFER_SIZE: i64 = 8192;type struct Name { ... }
type enum Name { ... }
type trait Name { ... }
type union Name { ... }Begins a type declaration; the keyword that follows says which kind. On its own, type Name = Existing; declares an alias.
type struct Name {
field: Type;
method(&this) -> Ret { ... }
}A value type with named fields and optional methods. Structs live on the stack and are passed by value. Fields are public by default and may carry = default values; methods take their receiver as &this, mut &this, or this.
type struct BufferedWriter<W> where W: Write {}Coalesces writes destined for W into larger flushes. The inner writer is borrowed by reference; the caller owns it, and it must outlive this writer.
type parameter Wwhere W: Write
where T: Ord + Clone, U: HashConstrains generic parameters to types that implement the listed traits, which is what makes those traits' methods callable on T. Bounds on one parameter join with +; parameters separate with ,. A where on a single method narrows the type's parameter for that method only.
type trait Write {
write_some(mut &this, bytes: &Slice<u8>) -> Result<i64, IoError>;
flush(mut &this) -> Result<(), IoError>;
write<T>(mut &this, data: T) -> Result<(), IoError>;
}A sink for bytes: a file, standard output, a socket, a String's buffer. An implementation provides write_some and flush; the rest (write_all, write_str, write_line, ...) are built on them.
private type struct Name { ... }
private:Confined to the module that declares it - for items and members alike. A private field or function reached from another module is E0353, and a private type named there is E0503. private: opens a block of such members.
BufferedWriter.writer: mut &Wmut &this
mut &TypeAn exclusive, mutating borrow. As a receiver, mut &this lets the method modify the fields - and callers can see that from the signature alone. As a parameter type, mut &T lets the callee mutate through the reference while the caller keeps ownership.
BufferedWriter.buffer: mut u8*mut name: Type = value;A mutable binding, reassignable after declaration - mutability is opt-in, const is the default. At module level it declares mutable global state. Before & it marks an exclusive reference or receiver instead.
BufferedWriter.capacity: i64BufferedWriter.length: i64import a::b;
import a::b::{ X, Y };
import a::b as c;
import a::b::*;Brings a module, or selected items from it, into scope. One path per declaration: use the brace form for several items, as to alias, and * for everything public (prefer the brace form; wildcards invite name collisions).
type struct BufferedWriter<W> where W: Write {}Coalesces writes destined for W into larger flushes. The inner writer is borrowed by reference; the caller owns it, and it must outlive this writer.
type struct Stdout {}Handle to process standard output. Unbuffered; wrap in LineWriter<Stdout> or BufferedWriter<Stdout> from io::buffered for the common "coalesce many small writes" case.
function stdout() -> StdoutA handle to the process's standard output, unbuffered: each write reaches the stream at once. Wrap it in a BufferedWriter or LineWriter to coalesce small writes.
const NAME: Type = value;At module level, a true compile-time constant, conventionally SCREAMING_SNAKE_CASE. (mut at module level declares mutable global state instead.)
const payload: Strtype struct Str {}A read-only view of UTF-8 text owned elsewhere: a string literal, a String, a file's bytes. Copying a Str copies the view, not the text, and it is valid only while what it views is. Str::new("text") views a literal; String.as_str() views a String.
mut out: Stdoutmut buffered: BufferedWriter<Stdout>static BufferedWriter::new(writer: mut &W) -> BufferedWriter<W>
where W: WriteWrap writer with a DEFAULT_BUFFER_SIZE-byte buffer. Panics on allocation failure.
mut out: Stdoutmut buffered: BufferedWriter<Stdout>BufferedWriter::write<T>(mut &this, data: T) -> Result<(), IoError>via trait Write
Write data in full, retrying short writes and Interrupted errors. Generic over the payload, dispatched at compile time via static match: a raw byte &Slice<u8>, a Str view, a NUL-terminated C string, or a single u8.
const payload: Strvalue?Error propagation. On a Result<T, E> it yields the T of an Ok and otherwise returns the Err(e) from the enclosing function unchanged; on an Option<T> it yields the T of a Some or returns None. It works on any type implementing Try, in a function whose return type implements FromResidual of it; an error of another type converts through From.
type struct LineWriter<W> {}A BufferedWriter that flushes after any write containing a \n. Appropriate for interactive stdout on a TTY, where "the user saw the line as soon as it was emitted" matters more than coalescing.
type parameter WLineWriter.inner: BufferedWriter<W>type parameter Wtype struct BufferedReader<R> where R: Read {}Pulls from R in buffer-sized chunks and serves reads from the buffer. Transforms a stream of small reads into a few large ones and makes read_line fast: no per-byte syscall.
type parameter Rwhere R: Read
type trait Read {
read(mut &this, buffer: mut &Slice<u8>) -> Result<i64, IoError>;
read_all(mut &this, buffer: mut &Slice<u8>) -> Result<i64, IoError>;
read_byte(mut &this) -> Result<Option<u8>, IoError>;
read_char(mut &this) -> Result<Option<char>, IoError>;
read_until(mut &this, delimiter: u8, out: mut &Array<u8>) -> Result<i64, IoError>;
read_exact(mut &this, buffer: mut &Slice<u8>) -> Result<(), IoError>;
read_to_end(mut &this, out: mut &Array<u8>) -> Result<i64, IoError>;
read_to_string(mut &this, out: mut &String) -> Result<i64, IoError>;
read_line(mut &this, out: mut &String) -> Result<i64, IoError>;
}A source of bytes: a file, a pipe, standard input, a socket. An implementation provides read; the rest (read_to_end, read_to_string, read_line, ...) are built on it.
BufferedReader.reader: mut &RBufferedReader.buffer: mut u8*BufferedReader.capacity: i64BufferedReader.position: i64BufferedReader.filled: i64type struct File {}An open file, closed when the value is released. It implements Read and Write; the static methods read or write a whole file in one call.
type struct BufferedReader<R> where R: Read {}Pulls from R in buffer-sized chunks and serves reads from the buffer. Transforms a stream of small reads into a few large ones and makes read_line fast: no per-byte syscall.
mut file: Filefor (mut i: i32 = 0; i < n; i++) { ... }
for (item in iterable) { ... }
for ((i, item) in items.iterate().enumerate()) { ... }Two forms. The C-style for (init; condition; step) scopes its loop variable to the body. for (x in expr) iterates an Iterator, a range such as 0..n, or an Iterable, which it consumes: an Array, a Slice of Copy elements, or a fixed-size array. A loop that only borrows writes its borrowing iterator, xs.iter() or xs.iterate_references(). The binding may be a tuple pattern that takes each item apart, nested and with _ elements: enumerate() yields (index, element) with an i64 index, and zip yields (a, b). A loop variable the body never reads is warned about (W0001); write _.
line: Result<String, IoError>for (item in iterable) { ... }Separates the loop variable from the sequence in a for loop. The sequence is evaluated once; the loop lowers to loop { match (it.next()) { Some(x) => .., None => break } }.
static BufferedReader::new(reader: mut &R) -> BufferedReader<R>
where R: ReadA reader that fills a buffer of the default size from reader, which must outlive it.
mut file: FileBufferedReader::lines(this) -> Lines<R>The rest of the source, one line at a time: each item is an owned String without its \n or \r\n, or the error that stopped the reading. A last line with no line ending is still a line.
const name: Type = value;An immutable binding: it cannot be reassigned after initialisation. The annotation may be omitted when an initialiser is present - the binding takes the initialiser's concrete type, inferred locally. Mutability is opt-in through mut.
const text: Stringtype struct String<A = GlobalAllocator> {}Owned, growable UTF-8 text. It dereferences to Str, the read-only view most text functions take, so every Str method reads a String too (s.contains(...), s.split(...)); as_str hands the view out.
line: Result<String, IoError>const text: StringString::as_str(&this) -> StrBorrow as a Str. Invalidated by the next mutating call.
type struct Lines<R> where R: Read {}The lines of a BufferedReader; see BufferedReader.lines.
type struct BufferedStream<S> {}A buffered connection for asynchronous code: it owns its transport S (a socket or a TLS session) and buffers both directions, so many small reads and writes become few large ones. It implements AsyncRead and AsyncWrite; make one with of.
type parameter SBufferedStream.inner: Stype parameter SBufferedStream.rbuf: Array<u8>type struct Array<T, A = GlobalAllocator> where A: Allocator {}A growable sequence of Ts stored contiguously, owning its elements; A is the allocator its storage comes from. Indexing out of range panics; get answers None instead.
BufferedStream.rpos: i64BufferedStream.scratch: Array<u8>BufferedStream.wbuf: Array<u8>const DEFAULT_BUFFER_SIZE: i64 = 8192;const DEFAULT_BUFFER_SIZE: i64 = 8192;BufferedWriter::buffered(&this) -> i64Number of bytes currently buffered but not yet flushed.
std::io::bufferedBufferedWriter::clear(mut &this) -> voidDiscard buffered bytes without writing them. Useful on error paths where the caller knows the output is garbage.
std::io::bufferedBufferedWriter::get_reference(&this) -> &WBorrow the inner writer. Useful for operations that bypass buffering (e.g., a direct flush on the underlying fd). Callers mutating through this must call BufferedWriter::flush first, or buffered bytes will land out of order.
static name(param: Type) -> Ret { ... }A method that belongs to the type rather than an instance, called as Type::name(..). For structs, static new(..) returning a struct literal is the idiomatic constructor.
(parameter) writer: mut &Wstatic BufferedWriter::with_capacity(writer: mut &W, capacity: i64) -> BufferedWriter<W>
where W: WriteWrap with an explicit buffer size. A capacity of zero or less is permitted but degenerate: no buffer is allocated and every write hits the sink directly. Panics on allocation failure.
(parameter) capacity: i64&this
mut &this
thisThe receiver of a method. Its first parameter declares how the method takes it: &this borrows read-only, mut &this borrows exclusively, and this / mut this move the value in and consume it. In the body, this.field reaches the members.
type struct LineWriter<W> {}A BufferedWriter that flushes after any write containing a \n. Appropriate for interactive stdout on a TTY, where "the user saw the line as soon as it was emitted" matters more than coalescing.
new T { field: value }
new Path(args)
new E::Variant
new T[n]Heap allocation. new T { .. } places a struct literal on the heap and yields a T*, and new E::V does the same for a unit variant. new Path(args) places the value a call returns, whatever its type: new Table::new(8), new Option<i64>::Some(41), new make_pair(3, 4). new T[n] reserves n uninitialised T - the typed malloc. The storage comes from the value type's Allocate implementation, or else the global allocator. A type is not a function, so new Point(1, 2) is refused (E0231).
BufferedReader::read_line(mut &this, out: mut &String) -> Result<i64, IoError>via trait Read
Override the trait default; line-reading is the whole point of BufferedReader, so we do it the fast way: scan the filled region for \n, copy the prefix wholesale, consume, refill only if we didn't hit the newline.
type enum Result<T, E> with [Eq, Clone, Debug] {
Ok(T);
Err(E);
}The outcome of an operation that can fail: Ok(value) on success, Err(error) on failure.
type struct IoError {
kind: IoErrorKind;
os_code: i32;
}The error of a failed I/O operation: its kind, the operating system's own code, and, when the operation named one, what it was doing and the path. It prints as could not open config.toml: not found.
IoErrorKind::InvalidDataThe bytes do not have the form the operation needs, such as text that is not UTF-8.
std::io::errorBufferedReader::fill_buffer(mut &this) -> Result<&Slice<u8>, IoError>Fill the buffer from the source if empty, then surface the filled region. Returns an empty slice at EOF. Paired with consume for zero-copy parsing: read a prefix, decide how many bytes are actually wanted, consume that many.
type struct Slice<T> {}The elements are reached through ptr, declared read-only: through a mut &Slice<T> it reads as a writable pointer, through a &Slice<T> as the read-only one it is.
BufferedReader::consume(mut &this, amount: i64) -> voidAdvance the buffer cursor past amount bytes. amount must not exceed available(); a larger value is a caller bug, and a negative one panics "out of range".
(parameter) reader: mut &R(parameter) amount: i64type struct Lines<R> where R: Read {}The lines of a BufferedReader; see BufferedReader.lines.
implement struct Name { ... }
implement trait Trait for Type { ... }
implement u64 { ... }Adds methods to a type outside its declaration. implement struct T (or enum, or a bare primitive) opens an inherent block; implement trait Tr for T supplies a trait's methods for one type. Resolution is at compile time - no dynamic dispatch.
type trait Name : Base {
method(&this, other: &This) -> Ret;
}Names a set of methods a type may implement. Inside the body This is the implementing type; methods may carry default bodies, and a trait may require a base trait (type trait Ord : Eq). Generic code asks for a trait with where T: Name.
implement trait Trait for Type { ... }Names the type a trait implementation is for. The block that follows supplies the bodies the trait requires.
language referencetype trait Drop {
drop(mut &this) -> void;
}A type that releases something when a value of it ends: memory, a file handle, a lock. The compiler calls drop once when an owned value goes out of scope; release a value early with mem::drop(value).
type parameter Rtype trait Iterator {
type Item;
next(mut &this) -> Option<This::Item>;
count(mut &this) -> i64;
fold<Acc, F>(mut &this, initial: Acc, f: F) -> Acc
where F: (Acc, This::Item) -> Acc;
for_each<F>(mut &this, f: F) -> void
where F: (This::Item) -> void;
take(this, n: i64) -> implement Iterator<This::Item>;
skip(this, n: i64) -> implement Iterator<This::Item>;
map<B, F>(this, f: F) -> implement Iterator<B>
where F: (This::Item) -> B;
filter<P>(this, pred: P) -> implement Iterator<This::Item>
where P: (&This::Item) -> boolean;
chain<J>(this, other: J) -> implement Iterator<This::Item>
where J: Iterator<This::Item>;
enumerate(this) -> implement Iterator<(i64, This::Item)>;
zip<J>(this, other: J) -> implement Iterator<(This::Item, J::Item)>
where J: Iterator;
collect<C>(this) -> C
where C: FromIterator<This::Item>;
sum<S>(this) -> S
where S: Sum, This: Iterator<S>;
reverse(this) -> implement Iterator<This::Item>
where This: DoubleEndedIterator;
peekable(this) -> implement Peekable<This::Item>;
flat_map<B, F>(this, f: F) -> implement Iterator<B::Item>
where F: (This::Item) -> B, B: Iterator;
flatten(this) -> implement Iterator<This::Item::Item>
where This::Item: Iterator;
take_while<P>(this, pred: P) -> implement Iterator<This::Item>
where P: (&This::Item) -> boolean;
skip_while<P>(this, pred: P) -> implement Iterator<This::Item>
where P: (&This::Item) -> boolean;
step_by(this, step: i64) -> implement Iterator<This::Item>;
filter_map<B, F>(this, f: F) -> implement Iterator<B>
where F: (This::Item) -> Option<B>;
any<P>(mut &this, pred: P) -> boolean
where P: (This::Item) -> boolean;
all<P>(mut &this, pred: P) -> boolean
where P: (This::Item) -> boolean;
find<P>(mut &this, pred: P) -> Option<This::Item>
where P: (&This::Item) -> boolean;
min(mut &this) -> Option<This::Item>
where This::Item: Ord;
max(mut &this) -> Option<This::Item>
where This::Item: Ord;
min_by<F>(mut &this, compare: F) -> Option<This::Item>
where F: (&This::Item, &This::Item) -> Ordering;
max_by<F>(mut &this, compare: F) -> Option<This::Item>
where F: (&This::Item, &This::Item) -> Ordering;
min_by_key<K, F>(mut &this, key: F) -> Option<This::Item>
where F: (&This::Item) -> K, K: Ord;
max_by_key<K, F>(mut &this, key: F) -> Option<This::Item>
where F: (&This::Item) -> K, K: Ord;
last(mut &this) -> Option<This::Item>;
nth(mut &this, n: i64) -> Option<This::Item>;
position<P>(mut &this, pred: P) -> Option<i64>
where P: (This::Item) -> boolean;
product<S>(this) -> S
where S: Product, This: Iterator<S>;
}A source of values handed out one at a time by next, until it returns None. for (x in source) drives one, and the adapter methods below build new iterators from it:
type trait AsyncRead {
async fill(mut &this) -> Result<i64, IoError>;
buffered(&this) -> &Slice<u8>;
consume(mut &this, count: i64) -> void;
scan_for(&this, delimiter: u8, from: i64) -> i64;
take_front(mut &this, count: i64) -> Result<Array<u8>, IoError>;
async ensure(mut &this, count: i64) -> Result<(), IoError>;
async read_exact(mut &this, count: i64) -> Result<Array<u8>, IoError>;
async read_some(mut &this, limit: i64) -> Result<Array<u8>, IoError>;
async read_until(mut &this, delimiter: u8, limit: i64) -> Result<Array<u8>, IoError>;
async read_line(mut &this, limit: i64) -> Result<String, IoError>;
async skip(mut &this, count: i64) -> Result<(), IoError>;
}A byte source that buffers what it reads inside itself.
std::io::traitstype trait AsyncWrite {
pending(mut &this) -> mut &Array<u8>;
async flush(mut &this) -> Result<(), IoError>;
queue<T>(mut &this, data: T) -> Result<(), IoError>;
async send<T>(mut &this, data: T) -> Result<(), IoError>;
}A byte sink that buffers what it is given until told to send it.
std::io::traitstype trait AsyncTransport {
async read_into(mut &this, buf: Array<u8>) -> Transfer;
async write_from(mut &this, buf: Array<u8>) -> Transfer;
}One raw, unbuffered async byte channel: what BufferedStream<S> needs of a transport, and nothing more.
static BufferedStream::of(inner: S) -> BufferedStream<S>Wrap an already-connected transport.
std::io::bufferedBufferedStream::transport(mut &this) -> mut S*The transport, for callers that need it directly (socket options, the negotiated ALPN protocol). Not for reading or writing — that would desynchronize the buffers.
std::io::bufferednamespace std::net::http::connection;HTTP/1.1 message framing over a buffered async connection.
module pagenamespace std::net::ws::frame;WebSocket framing (RFC 6455 section 5).
(parameter) inner: Stype struct BufferedStream<S> {}A buffered connection for asynchronous code: it owns its transport S (a socket or a TLS session) and buffers both directions, so many small reads and writes become few large ones. It implements AsyncRead and AsyncWrite; make one with of.