1
Fork 0
rust/library/portable-simd/crates/core_simd
Josh Triplett a5a60d75a8 Add size_of, size_of_val, align_of, and align_of_val to the prelude
Many, many projects use `size_of` to get the size of a type. However,
it's also often equally easy to hardcode a size (e.g. `8` instead of
`size_of::<u64>()`). Minimizing friction in the use of `size_of` helps
ensure that people use it and make code more self-documenting.

The name `size_of` is unambiguous: the name alone, without any prefix or
path, is self-explanatory and unmistakeable for any other functionality.
Adding it to the prelude cannot produce any name conflicts, as any local
definition will silently shadow the one from the prelude. Thus, we don't
need to wait for a new edition prelude to add it.

Add `size_of_val`, `align_of`, and `align_of_val` as well, with similar
justification: widely useful, self-explanatory, unmistakeable for
anything else, won't produce conflicts.
2024-05-13 15:11:28 +02:00
..
examples Merge commit 'e0e9a4517f' into sync-portable-simd-2023-11-19 2023-11-26 08:50:06 -05:00
src Add size_of, size_of_val, align_of, and align_of_val to the prelude 2024-05-13 15:11:28 +02:00
tests rename expose_addr to expose_provenance 2024-04-03 16:00:38 +02:00
Cargo.toml Merge commit 'e0e9a4517f' into sync-portable-simd-2023-11-19 2023-11-26 08:50:06 -05:00
LICENSE-APACHE Add 'library/portable-simd/' from commit '1ce1c645cf' 2021-11-12 16:58:25 -08:00
LICENSE-MIT Add 'library/portable-simd/' from commit '1ce1c645cf' 2021-11-12 16:58:25 -08:00
webdriver.json Add 'library/portable-simd/' from commit '1ce1c645cf' 2021-11-12 16:58:25 -08:00