Struct kiwi_schema::ByteBuffer [] [src]

pub struct ByteBuffer<'a> { /* fields omitted */ }

A Kiwi byte buffer meant for reading.

Example usage:

let mut bb = kiwi_schema::ByteBuffer::new(&[240, 159, 141, 149, 0, 133, 242, 210, 237]);
assert_eq!(bb.read_string(), Ok("🍕"));
assert_eq!(bb.read_var_float(), Ok(123.456));

Methods

impl<'a> ByteBuffer<'a>
[src]

[src]

Create a new ByteBuffer that wraps the provided byte slice. The lifetime of the returned ByteBuffer must not outlive the lifetime of the byte slice.

[src]

Retrieves the underlying byte slice.

[src]

Retrieves the current index into the underlying byte slice. This starts off as 0 and ends up as self.data().len() when everything has been read.

[src]

Try to read a boolean value starting at the current index.

[src]

Try to read a byte starting at the current index.

[src]

Try to read a variable-length signed 32-bit integer starting at the current index.

[src]

Try to read a variable-length unsigned 32-bit integer starting at the current index.

[src]

Try to read a variable-length 32-bit floating-point number starting at the current index.

[src]

Try to read a UTF-8 string starting at the current index. This string is returned as a slice so it just aliases the underlying memory.