Crate zero[−][src]
Functions for reading binary data into Rust data structures. All functions are zero-allocation.
There are functions for reading a single value, an array of values, a single null-terminated utf8 string (which should also work with ascii strings), and an array of null-terminated strings terminated by another null byte.
Functions preserve the lifetime of the underlying data. These functions are
memory safe, although this is in part based on the assumption that the
client only implements the unsafe trait Pod
where safe to do so.
Functions assert that the provided data is large enough. The string
functions check that strings are valid utf8. There is no checking that the
the privided input will produce a valid object (for example, an enum has a
valid discriminant). The user must assert this by implementing the trait
Pod
.
There are also unsafe versions of most functions which do not require the
return type to implement Pod
and which do no checking.
Structs
StrReaderIterator | Iterates over |
Traits
Pod | Implementing this trait means that the concrete type is plain old data (POD).
Precisely, by implementing |
Functions
read | Reads a single |
read_array | Read an array of |
read_array_unsafe⚠ | Reads an array of |
read_str | Read a string from |
read_str_unsafe⚠ | Reads a null-terminated string from |
read_strs_to_null | Returns an iterator which will return a sequence of strings from |
read_unsafe⚠ | Reads a |