chars.rs |
ULE implementation for the `char` type. |
6413 |
custom.rs |
|
5791 |
encode.rs |
|
16195 |
macros.rs |
|
1301 |
mod.rs |
Traits over unaligned little-endian data (ULE, pronounced "yule").
The main traits for this module are [`ULE`], [`AsULE`] and, [`VarULE`].
See [the design doc](https://github.com/unicode-org/icu4x/blob/main/utils/zerovec/design_doc.md) for details on how these traits
works under the hood. |
18881 |
multi.rs |
|
6539 |
niche.rs |
|
7299 |
option.rs |
|
8802 |
plain.rs |
ULE implementation for Plain Old Data types, including all sized integers. |
12987 |
slices.rs |
|
3997 |
test_utils.rs |
|
1316 |
tuple.rs |
ULE impls for tuples.
Rust does not guarantee the layout of tuples, so ZeroVec defines its own tuple ULE types.
Impls are defined for tuples of up to 6 elements. For longer tuples, use a custom struct
with [`#[make_ule]`](crate::make_ule).
# Examples
```
use zerovec::ZeroVec;
// ZeroVec of tuples!
let zerovec: ZeroVec<(u32, char)> = [(1, 'a'), (1234901, '啊'), (100, 'अ')]
.iter()
.copied()
.collect();
assert_eq!(zerovec.get(1), Some((1234901, '啊')));
``` |
6734 |
tuplevar.rs |
[`VarULE`] impls for tuples.
This module exports [`Tuple2VarULE`], [`Tuple3VarULE`], ..., the corresponding [`VarULE`] types
of tuples containing purely [`VarULE`] types.
This can be paired with [`VarTupleULE`] to make arbitrary combinations of [`ULE`] and [`VarULE`] types.
[`VarTupleULE`]: crate::ule::vartuple::VarTupleULE |
13848 |
vartuple.rs |
Types to help compose fixed-size [`ULE`] and variable-size [`VarULE`] primitives.
This module exports [`VarTuple`] and [`VarTupleULE`], which allow a single sized type and
a single unsized type to be stored together as a [`VarULE`].
# Examples
```
use zerovec::ule::vartuple::{VarTuple, VarTupleULE};
use zerovec::VarZeroVec;
struct Employee<'a> {
id: u32,
name: &'a str,
};
let employees = [
Employee {
id: 12345,
name: "Jane Doe",
},
Employee {
id: 67890,
name: "John Doe",
},
];
let employees_as_var_tuples = employees
.into_iter()
.map(|x| VarTuple {
sized: x.id,
variable: x.name,
})
.collect::<Vec<_>>();
let employees_vzv: VarZeroVec<VarTupleULE<u32, str>> =
employees_as_var_tuples.as_slice().into();
assert_eq!(employees_vzv.len(), 2);
assert_eq!(employees_vzv.get(0).unwrap().sized.as_unsigned_int(), 12345);
assert_eq!(&employees_vzv.get(0).unwrap().variable, "Jane Doe");
assert_eq!(employees_vzv.get(1).unwrap().sized.as_unsigned_int(), 67890);
assert_eq!(&employees_vzv.get(1).unwrap().variable, "John Doe");
``` |
10533 |