API
#io
Xu 0.8.8 API
import: #io
counts: 25 fns, 39 methods, 17 types, 1 consts, 6 ifaces
Buffer / Cursor, stream copying, EOF/error results with data, and write-progress contracts; also multi/tee/section/pipe.
struct@ Writer
struct@ Writer {
fn write(&string) int
}
Purpose
Writer / Reader are the legacy -shaped method sets (structural). copy is Cursor→Buffer and returns owned string. stream.xu supplies generic borrowed StreamReader/StreamWriter copying with bounded owning string chunks. copy_to returns Buffer. Cursor/SectionCursor provide seek/read_at.
Parameters
write fn write(&string) int- Method on `Writer`: write data and return the byte count.
(Writer) write
Purpose
Method on `Writer`: write data and return the byte count.
Parameters
self Self- receiver Self (value receiver)
string &string- string (borrowed; caller keeps it; type &string)
Returns
int — bytes written
struct@ Reader
struct@ Reader {
fn read_n(int) string
}
Purpose
Method-set constraint `Reader`. Implementing types must provide the methods below. Not an interface value.
Parameters
read_n fn read_n(int) string- Method on `Reader`: read at most n bytes; may return shorter or empty at end.
(Reader) read_n
Purpose
Method on `Reader`: read at most n bytes; may return shorter or empty at end.
Parameters
self Self- receiver Self (value receiver)
int int- int (int)
Returns
string — result string
struct Buffer
pub struct Buffer {
pub data string
pub off int
}
Purpose
Public struct `Buffer`.
Parameters
data string- data
off int- offset
struct Cursor
pub struct Cursor {
pub data string
pub off int
}
Purpose
Public struct `Cursor`.
Parameters
data string- data
off int- offset
buffer
Purpose
buffer; returns Buffer.
Parameters
none
Returns
Buffer — a value of this type
buffer_from
pub fn buffer_from(s string) Buffer
Purpose
Buffer from.
Parameters
s string- source string (string)
Returns
Buffer — a value of this type
cursor
pub fn cursor(s string) Cursor
Purpose
cursor; returns Cursor.
Parameters
s string- source string (string)
Returns
Cursor — a value of this type
(&mut Cursor) reset
pub fn (c &mut Cursor) reset(s string)
Purpose
Method on `&mut Cursor`: clear internal state so the value can be reused.
Parameters
c &mut Cursor- receiver &mut Cursor (exclusive borrow)
s string- source string (string)
(&mut Buffer) reset
pub fn (b &mut Buffer) reset()
Purpose
Method on `&mut Buffer`: clear internal state so the value can be reused.
Parameters
b &mut Buffer- receiver &mut Buffer (exclusive borrow)
(&Buffer) len
pub fn (b &Buffer) len() int
Purpose
Method on `&Buffer`: return the length.
Parameters
b &Buffer- receiver &Buffer (borrow)
Returns
int — a value of this type
(&Buffer) cap
pub fn (b &Buffer) cap() int
Purpose
Method on `&Buffer`: return the capacity.
Parameters
b &Buffer- receiver &Buffer (borrow)
Returns
int — a value of this type
(&Cursor) size
pub fn (c &Cursor) size() int
Purpose
Method on `&Cursor`: return the size.
Parameters
c &Cursor- receiver &Cursor (borrow)
Returns
int — a value of this type
(&mut Buffer) write
pub fn (b &mut Buffer) write(data &string) int
Purpose
Method on `&mut Buffer`: write data and return the byte count.
Parameters
b &mut Buffer- receiver &mut Buffer (exclusive borrow)
data &string- data (borrowed; caller keeps it; type &string)
Returns
int — bytes written
(&mut Buffer) write_str
pub fn (b &mut Buffer) write_str(s string) int
Purpose
write_str appends an owned string without requiring a borrow of a local.
Parameters
b &mut Buffer- receiver &mut Buffer (exclusive borrow)
s string- source string (string)
Returns
int — a value of this type
(&mut Buffer) write_byte
pub fn (b &mut Buffer) write_byte(c int) int
Purpose
Method on `&mut Buffer`: write one byte.
Parameters
b &mut Buffer- receiver &mut Buffer (exclusive borrow)
c int- byte or character code (int)
Returns
int — bytes written
(&mut Buffer) read_n
pub fn (b &mut Buffer) read_n(n int) string
Purpose
Method on `&mut Buffer`: read at most n bytes; may return shorter or empty at end.
Parameters
b &mut Buffer- receiver &mut Buffer (exclusive borrow)
n int- count, length, or limit (int)
Returns
string — result string
(&Buffer) bytes
pub fn (b &Buffer) bytes() string
Purpose
Method on `&Buffer`: return the buffered bytes.
Parameters
b &Buffer- receiver &Buffer (borrow)
Returns
string — result string
(&mut Cursor) read_n
pub fn (c &mut Cursor) read_n(n int) string
Purpose
Method on `&mut Cursor`: read at most n bytes; may return shorter or empty at end.
Parameters
c &mut Cursor- receiver &mut Cursor (exclusive borrow)
n int- count, length, or limit (int)
Returns
string — result string
copy
pub fn copy(dst Buffer, src Cursor) string
Purpose
copy drains src into dst and returns the remaining dst bytes as a string.
Parameters
dst Buffer- destination (Buffer)
src Cursor- source (Cursor)
Returns
string — result string
copy_to
pub fn copy_to(dst Buffer, src Cursor) Buffer
Purpose
copy_to is the Buffer-returning form.
Parameters
dst Buffer- destination (Buffer)
src Cursor- source (Cursor)
Returns
Buffer — a value of this type
read_all
pub fn read_all(src Cursor) string
Purpose
Read all.
Parameters
src Cursor- source (Cursor)
Returns
string — result string
const eof
Purpose
Public constant `eof`. Value `"EOF"`.
Parameters
none
(&Cursor) remaining
pub fn (c &Cursor) remaining() int
Purpose
Call `remaining` on `&Cursor`.
Parameters
c &Cursor- receiver &Cursor (borrow)
Returns
int — a value of this type
(&mut Cursor) seek
pub fn (c &mut Cursor) seek(offset int, whence int) int
Purpose
Method on `&mut Cursor`: move the read position. whence 0/1/2 = absolute / relative / from end. Throws on failure.
Parameters
c &mut Cursor- receiver &mut Cursor (exclusive borrow)
offset int- offset (int)
whence int- seek base: 0 start / 1 current / 2 end (int)
Returns
int — a value of this type
(&Cursor) read_at
pub fn (c &Cursor) read_at(n int, off int) string
Purpose
Method on `&Cursor`: read at most n bytes starting at offset off. Throws on failure.
Parameters
c &Cursor- receiver &Cursor (borrow)
n int- count, length, or limit (int)
off int- offset (int)
Returns
string — result string
read_full
pub fn read_full(src Cursor, n int) string
Purpose
Read full.
Parameters
src Cursor- source (Cursor)
n int- count, length, or limit (int)
Returns
string — result string
read_at_least
pub fn read_at_least(src Cursor, min int, max int) string
Purpose
Read at least. Throws on failure.
Parameters
src Cursor- source (Cursor)
min int- minimum (int)
max int- maximum (int)
Returns
string — result string
copy_n
pub fn copy_n(dst Buffer, src Cursor, n int) string
Purpose
Copy n. Throws on failure.
Parameters
dst Buffer- destination (Buffer)
src Cursor- source (Cursor)
n int- count, length, or limit (int)
Returns
string — result string
struct LimitCursor
pub struct LimitCursor {
pub src Cursor
pub n int
}
Purpose
Public struct `LimitCursor`.
Parameters
src Cursor- source
n int- count, length, or limit
limit_cursor
pub fn limit_cursor(src Cursor, n int) LimitCursor
Purpose
Limit cursor.
Parameters
src Cursor- source (Cursor)
n int- count, length, or limit (int)
Returns
LimitCursor — a value of this type
(LimitCursor) remaining
pub fn (l LimitCursor) remaining() int
Purpose
Call `remaining` on `LimitCursor`.
Parameters
l LimitCursor- receiver LimitCursor (value receiver)
Returns
int — a value of this type
(&mut LimitCursor) read_n
pub fn (l &mut LimitCursor) read_n(n int) string
Purpose
Method on `&mut LimitCursor`: read at most n bytes; may return shorter or empty at end.
Parameters
l &mut LimitCursor- receiver &mut LimitCursor (exclusive borrow)
n int- count, length, or limit (int)
Returns
string — result string
struct Discard
pub struct Discard {
pub n int
}
Purpose
Public struct `Discard`.
Parameters
n int- count, length, or limit
discard
Purpose
discard; returns Discard.
Parameters
none
Returns
Discard — a value of this type
(&mut Discard) write
pub fn (d &mut Discard) write(data &string) int
Purpose
Method on `&mut Discard`: write data and return the byte count.
Parameters
d &mut Discard- receiver &mut Discard (exclusive borrow)
data &string- data (borrowed; caller keeps it; type &string)
Returns
int — bytes written
(Discard) written
pub fn (d Discard) written() int
Purpose
Call `written` on `Discard`.
Parameters
d Discard- receiver Discard (value receiver)
Returns
int — a value of this type
struct MultiCursor
pub struct MultiCursor {
pub chunks []string
pub i int
pub off int
}
Purpose
Concatenate string snapshots ( MultiReader, bound to Cursor-shaped chunks — no generic Reader). One read_n drains the current chunk only empty/exhausted chunks are skipped in the same call.
Parameters
chunks []string- field ([]string)
i int- index or integer
off int- offset
multi_cursor
pub fn multi_cursor(parts <-> string) MultiCursor
Purpose
Multi cursor.
Parameters
parts <-> string- variadic string (seen inside the function as []string)
Returns
MultiCursor — a value of this type
(&mut MultiCursor) read_n
pub fn (m &mut MultiCursor) read_n(n int) string
Purpose
Method on `&mut MultiCursor`: read at most n bytes; may return shorter or empty at end.
Parameters
m &mut MultiCursor- receiver &mut MultiCursor (exclusive borrow)
n int- count, length, or limit (int)
Returns
string — result string
struct MultiBuffer
pub struct MultiBuffer {
pub parts []string
}
Purpose
Write the same bytes to n owning destinations ( MultiWriter).
Parameters
parts []string- parts
multi_buffer
pub fn multi_buffer(n int) MultiBuffer
Purpose
Multi buffer.
Parameters
n int- count, length, or limit (int)
Returns
MultiBuffer — a value of this type
(&mut MultiBuffer) write
pub fn (m &mut MultiBuffer) write(data &string) int
Purpose
Method on `&mut MultiBuffer`: write data and return the byte count.
Parameters
m &mut MultiBuffer- receiver &mut MultiBuffer (exclusive borrow)
data &string- data (borrowed; caller keeps it; type &string)
Returns
int — bytes written
(&MultiBuffer) text
pub fn (m &MultiBuffer) text(i int) string
Purpose
Method on `&MultiBuffer`: return the current text.
Parameters
m &MultiBuffer- receiver &MultiBuffer (borrow)
i int- index or integer (int)
Returns
string — result string
struct Tee
pub struct Tee {
pub src Cursor
pub dst Buffer
}
Purpose
Read from src, copy each chunk into dst ( TeeReader).
Parameters
src Cursor- source
dst Buffer- destination
tee
pub fn tee(src Cursor, dst Buffer) Tee
Purpose
tee; returns Tee.
Parameters
src Cursor- source (Cursor)
dst Buffer- destination (Buffer)
Returns
Tee — a value of this type
(&mut Tee) read_n
pub fn (t &mut Tee) read_n(n int) string
Purpose
Method on `&mut Tee`: read at most n bytes; may return shorter or empty at end.
Parameters
t &mut Tee- receiver &mut Tee (exclusive borrow)
n int- count, length, or limit (int)
Returns
string — result string
(&Tee) copied
pub fn (t &Tee) copied() string
Purpose
Call `copied` on `&Tee`.
Parameters
t &Tee- receiver &Tee (borrow)
Returns
string — result string
struct SectionCursor
pub struct SectionCursor {
pub data string
pub base int
pub limit int
pub off int
}
Purpose
Window into a string snapshot ( SectionReader + ReadAt/Seek).
Parameters
data string- data
base int- numeric base
limit int- field (int)
off int- offset
section_cursor
pub fn section_cursor(s string, off int, n int) SectionCursor
Purpose
Section cursor.
Parameters
s string- source string (string)
off int- offset (int)
n int- count, length, or limit (int)
Returns
SectionCursor — a value of this type
(&mut SectionCursor) read_n
pub fn (s &mut SectionCursor) read_n(n int) string
Purpose
Method on `&mut SectionCursor`: read at most n bytes; may return shorter or empty at end.
Parameters
s &mut SectionCursor- receiver &mut SectionCursor (exclusive borrow)
n int- count, length, or limit (int)
Returns
string — result string
(&SectionCursor) size
pub fn (s &SectionCursor) size() int
Purpose
Method on `&SectionCursor`: return the size.
Parameters
s &SectionCursor- receiver &SectionCursor (borrow)
Returns
int — a value of this type
(&mut SectionCursor) seek
pub fn (s &mut SectionCursor) seek(offset int, whence int) int
Purpose
Method on `&mut SectionCursor`: move the read position. whence 0/1/2 = absolute / relative / from end. Throws on failure.
Parameters
s &mut SectionCursor- receiver &mut SectionCursor (exclusive borrow)
offset int- offset (int)
whence int- seek base: 0 start / 1 current / 2 end (int)
Returns
int — a value of this type
(&SectionCursor) read_at
pub fn (s &SectionCursor) read_at(n int, off int) string
Purpose
Method on `&SectionCursor`: read at most n bytes starting at offset off. Throws on failure.
Parameters
s &SectionCursor- receiver &SectionCursor (borrow)
n int- count, length, or limit (int)
off int- offset (int)
Returns
string — result string
struct PipeReader
pub struct PipeReader {
pub r chan string
pub buf string
pub off int
}
Purpose
In-memory one-way pipe ( io.Pipe shape; queue is a bounded chan like net.pipe, not a synchronous unbuffered handshake).
Parameters
r chan string- rune (Unicode code point)
buf string- buffer
off int- offset
struct PipeWriter
pub struct PipeWriter {
pub w chan string
pub closed int
}
Purpose
Public struct `PipeWriter`.
Parameters
w chan string- writer or width
closed int- field (int)
struct Pipe
pub struct Pipe {
pub r PipeReader
pub w PipeWriter
}
Purpose
Public struct `Pipe`.
Parameters
r PipeReader- rune (Unicode code point)
w PipeWriter- writer or width
pipe
Purpose
pipe; returns Pipe.
Parameters
none
Returns
Pipe — a value of this type
(&mut PipeReader) read_n
pub fn (p &mut PipeReader) read_n(n int) string
Purpose
Method on `&mut PipeReader`: read at most n bytes; may return shorter or empty at end.
Parameters
p &mut PipeReader- receiver &mut PipeReader (exclusive borrow)
n int- count, length, or limit (int)
Returns
string — result string
(PipeWriter) write
pub fn (w PipeWriter) write(data &string) int
Purpose
Method on `PipeWriter`: write data and return the byte count. Throws on failure.
Parameters
w PipeWriter- receiver PipeWriter (value receiver)
data &string- data (borrowed; caller keeps it; type &string)
Returns
int — bytes written
(&mut PipeWriter) close
pub fn (w &mut PipeWriter) close() int
Purpose
Method on `&mut PipeWriter`: close the resource.
Parameters
w &mut PipeWriter- receiver &mut PipeWriter (exclusive borrow)
Returns
int — a value of this type
enum ReadResult
pub enum ReadResult {
Data(string)
End(string)
Failed(string, errors.Error)
}
Purpose
Owned chunks; terminal conditions may accompany the last bytes.
Parameters
none
enum WriteResult
pub enum WriteResult {
Written(int)
Failed(int, errors.Error)
Unknown(errors.Error)
}
Purpose
Counts acknowledge a prefix of this call's input. Unknown is required when a legacy operation throws after effects it cannot quantify.
Parameters
none
enum CopyResult
pub enum CopyResult {
Copied(int)
Failed(int, errors.Error)
Uncertain(int, errors.Error)
}
Purpose
Failed has an exact accepted count; Uncertain has a confirmed lower bound.
Parameters
none
struct@ ProgressReader
pub struct@ ProgressReader {
fn read_result(int) ReadResult
}
Purpose
Method-set constraint `ProgressReader`. Implementing types must provide the methods below. Not an interface value.
Parameters
read_result fn read_result(int) ReadResult- Method on `ProgressReader`: read result.
(ProgressReader) read_result
fn read_result(int) ReadResult
Purpose
Method on `ProgressReader`: read result.
Parameters
self Self- receiver Self (value receiver)
int int- int (int)
Returns
ReadResult — a value of this type
struct@ ProgressWriter
pub struct@ ProgressWriter {
fn write_result(string) WriteResult
}
Purpose
Method-set constraint `ProgressWriter`. Implementing types must provide the methods below. Not an interface value.
Parameters
write_result fn write_result(string) WriteResult- Method on `ProgressWriter`: write result.
(ProgressWriter) write_result
fn write_result(string) WriteResult
Purpose
Method on `ProgressWriter`: write result.
Parameters
self Self- receiver Self (value receiver)
string string- string (string)
Returns
WriteResult — a value of this type
struct LegacyReader#R:StreamReader
pub struct LegacyReader#R:StreamReader {
pub src R
}
Purpose
Legacy readers cannot recover bytes that were lost when throwing.
Parameters
src R- source
struct LegacyWriter#W:StreamWriter
pub struct LegacyWriter#W:StreamWriter {
pub dst W
}
Purpose
Public struct `LegacyWriter#W:StreamWriter`.
Parameters
dst W- destination
progress_reader
pub fn progress_reader#R:StreamReader(src R) LegacyReader#R
Purpose
Progress reader.
Parameters
src R- source (R)
Returns
LegacyReader#R — a value of this type
progress_writer
pub fn progress_writer#W:StreamWriter(dst W) LegacyWriter#W
Purpose
Progress writer.
Parameters
dst W- destination (W)
Returns
LegacyWriter#W — a value of this type
(&mut LegacyReader#R) read_result
pub fn (r &mut LegacyReader#R) read_result(n int) ReadResult
Purpose
Method on `&mut LegacyReader#R`: read result.
Parameters
r &mut LegacyReader#R- receiver &mut LegacyReader#R (exclusive borrow)
n int- count, length, or limit (int)
Returns
ReadResult — a value of this type
(&mut LegacyWriter#W) write_result
pub fn (w &mut LegacyWriter#W) write_result(data string) WriteResult
Purpose
Method on `&mut LegacyWriter#W`: write result.
Parameters
w &mut LegacyWriter#W- receiver &mut LegacyWriter#W (exclusive borrow)
data string- data (string)
Returns
WriteResult — a value of this type
copy_result
pub fn copy_result#W:ProgressWriter,R:ProgressReader(dst &mut W, src &mut R) CopyResult
Purpose
Copy result.
Parameters
dst &mut W- destination (exclusive borrow; type &mut W)
src &mut R- source (exclusive borrow; type &mut R)
Returns
CopyResult — a value of this type
copy_result_buffer
pub fn copy_result_buffer#W:ProgressWriter,R:ProgressReader(dst &mut W, src &mut R, size int) CopyResult
Purpose
Copy result buffer.
Parameters
dst &mut W- destination (exclusive borrow; type &mut W)
src &mut R- source (exclusive borrow; type &mut R)
size int- size (int)
Returns
CopyResult — a value of this type
copy_result_n
pub fn copy_result_n#W:ProgressWriter,R:ProgressReader(dst &mut W, src &mut R, n int) CopyResult
Purpose
Copy result n.
Parameters
dst &mut W- destination (exclusive borrow; type &mut W)
src &mut R- source (exclusive borrow; type &mut R)
n int- count, length, or limit (int)
Returns
CopyResult — a value of this type
(&mut Cursor) read_result
pub fn (c &mut Cursor) read_result(n int) ReadResult
Purpose
Method on `&mut Cursor`: read result.
Parameters
c &mut Cursor- receiver &mut Cursor (exclusive borrow)
n int- count, length, or limit (int)
Returns
ReadResult — a value of this type
(&mut Buffer) read_result
pub fn (b &mut Buffer) read_result(n int) ReadResult
Purpose
Method on `&mut Buffer`: read result.
Parameters
b &mut Buffer- receiver &mut Buffer (exclusive borrow)
n int- count, length, or limit (int)
Returns
ReadResult — a value of this type
(&mut Buffer) write_result
pub fn (b &mut Buffer) write_result(data string) WriteResult
Purpose
Method on `&mut Buffer`: write result.
Parameters
b &mut Buffer- receiver &mut Buffer (exclusive borrow)
data string- data (string)
Returns
WriteResult — a value of this type
(&mut Discard) write_result
pub fn (d &mut Discard) write_result(data string) WriteResult
Purpose
Method on `&mut Discard`: write result.
Parameters
d &mut Discard- receiver &mut Discard (exclusive borrow)
data string- data (string)
Returns
WriteResult — a value of this type
enum ReadInto
pub enum ReadInto {
Filled(int)
End(int)
Failed(int, errors.Error)
}
Purpose
ReadInto reports how many bytes were stored in the caller's buffer. The destination is exclusively borrowed for the call and is never grown. The result owns only the count and error; it does not borrow the buffer. Bytes outside the written prefix stay unchanged. A zero count performs no I/O.
Parameters
none
(&mut Cursor) read_into
pub fn (c &mut Cursor) read_into(dst &mut []int, off int, n int) ReadInto
Purpose
Method on `&mut Cursor`: read into.
Parameters
c &mut Cursor- receiver &mut Cursor (exclusive borrow)
dst &mut []int- destination (exclusive borrow; type &mut []int)
off int- offset (int)
n int- count, length, or limit (int)
Returns
ReadInto — a value of this type
(&mut Buffer) read_into
pub fn (b &mut Buffer) read_into(dst &mut []int, off int, n int) ReadInto
Purpose
Method on `&mut Buffer`: read into.
Parameters
b &mut Buffer- receiver &mut Buffer (exclusive borrow)
dst &mut []int- destination (exclusive borrow; type &mut []int)
off int- offset (int)
n int- count, length, or limit (int)
Returns
ReadInto — a value of this type
read_into
pub fn read_into#R:ProgressReader(src &mut R, dst &mut []int, off int, n int) ReadInto
Purpose
One synchronous read_result, then a copy into the exclusive window. The temporary owned chunk dies before return. Invalid counts are not stored. This does not retry and does not replace Cursor/Buffer.read_into.
Parameters
src &mut R- source (exclusive borrow; type &mut R)
dst &mut []int- destination (exclusive borrow; type &mut []int)
off int- offset (int)
n int- count, length, or limit (int)
Returns
ReadInto — a value of this type
struct@ StreamReader
pub struct@ StreamReader {
fn read_n(int) string
}
Purpose
read_n(n>0) returns at most n bytes. Empty string or an error with message eof ends the stream; other errors propagate. Unlike Reader, this API cannot return bytes and an error in the same operation.
Parameters
read_n fn read_n(int) string- Method on `StreamReader`: read at most n bytes; may return shorter or empty at end.
(StreamReader) read_n
Purpose
Method on `StreamReader`: read at most n bytes; may return shorter or empty at end.
Parameters
self Self- receiver Self (value receiver)
int int- int (int)
Returns
string — result string
struct@ StreamWriter
pub struct@ StreamWriter {
fn write_str(string) int
}
Purpose
write_str consumes one owning chunk. It must accept the whole chunk or throw; returning a shorter count is a short write, never an invitation to replay a partially accepted chunk. The destination may retain data itself.
Parameters
write_str fn write_str(string) int- Method on `StreamWriter`: write a string.
(StreamWriter) write_str
Purpose
Method on `StreamWriter`: write a string.
Parameters
self Self- receiver Self (value receiver)
string string- string (string)
Returns
int — a value of this type
copy_stream
pub fn copy_stream#W:StreamWriter,R:StreamReader(dst &mut W, src &mut R) int
Purpose
The three public forms retain their independently tested copy contracts. Generic forwarding is supported; no additional whole-stream staging is used. Both endpoints are borrowed; their partial effects remain visible on errors. Throws on failure.
Parameters
dst &mut W- destination (exclusive borrow; type &mut W)
src &mut R- source (exclusive borrow; type &mut R)
Returns
int — a value of this type
copy_stream_buffer
pub fn copy_stream_buffer#W:StreamWriter,R:StreamReader(dst &mut W, src &mut R, size int) int
Purpose
Maximum owning chunk size, with no whole-stream staging. Throws on failure.
Parameters
dst &mut W- destination (exclusive borrow; type &mut W)
src &mut R- source (exclusive borrow; type &mut R)
size int- size (int)
Returns
int — a value of this type
copy_stream_n
pub fn copy_stream_n#W:StreamWriter,R:StreamReader(dst &mut W, src &mut R, n int) int
Purpose
Exactly n bytes, with no over-read. n=0 touches neither endpoint. Throws on failure.
Parameters
dst &mut W- destination (exclusive borrow; type &mut W)
src &mut R- source (exclusive borrow; type &mut R)
n int- count, length, or limit (int)
Returns
int — a value of this type
(&mut Discard) write_str
pub fn (d &mut Discard) write_str(data string) int
Purpose
Method on `&mut Discard`: write a string.
Parameters
d &mut Discard- receiver &mut Discard (exclusive borrow)
data string- data (string)
Returns
int — a value of this type