stringio
In-Memory String I/O
Functions
| Function | Description |
|---|---|
_sio_byte_at | |
_sio_copy | |
sio_new | Create empty StringIO with given capacity. |
sio_from | Create StringIO from existing string. |
sio_write | Write data at current position. Returns bytes written. |
sio_read | Read n bytes from current position. Returns bytes read. |
sio_getline | Read until newline or max bytes. Returns bytes read (including newline). |
sio_seek | Set read/write position. |
sio_rewind | Reset position to beginning. |
sio_eof | 1 if at end of data. |
sio_len | Current data length. |
sio_pos | Current read/write position. |
sio_string | Copy all contents to out buffer. Returns length. |
sio_putc | Write a single byte at current position. |
sio_getc | Read a single byte at current position. Returns -1 at EOF. |
Details
_sio_byte_at
fn _sio_byte_at(buf: &i8, idx: i64) -> i64_sio_copy
fn _sio_copy(dst: &i8, doff: i64, src: &i8, soff: i64, n: i64)sio_new
fn sio_new(cap: i64) -> &i64Create empty StringIO with given capacity.
sio_from
fn sio_from(src: &i8, len: i64) -> &i64Create StringIO from existing string.
sio_write
fn sio_write(sio: &i64, data: &i8, dlen: i64) -> i64Write data at current position. Returns bytes written.
sio_read
fn sio_read(sio: &i64, out: &i8, n: i64) -> i64Read n bytes from current position. Returns bytes read.
sio_getline
fn sio_getline(sio: &i64, out: &i8, max: i64) -> i64Read until newline or max bytes. Returns bytes read (including newline).
sio_seek
fn sio_seek(sio: &i64, pos: i64)Set read/write position.
sio_rewind
fn sio_rewind(sio: &i64)Reset position to beginning.
sio_eof
fn sio_eof(sio: &i64) -> i641 if at end of data.
sio_len
fn sio_len(sio: &i64) -> i64Current data length.
sio_pos
fn sio_pos(sio: &i64) -> i64Current read/write position.
sio_string
fn sio_string(sio: &i64, out: &i8) -> i64Copy all contents to out buffer. Returns length.
sio_putc
fn sio_putc(sio: &i64, ch: i64) -> i64Write a single byte at current position.
sio_getc
fn sio_getc(sio: &i64) -> i64Read a single byte at current position. Returns -1 at EOF.