Commit Graph

147 Commits

Author SHA1 Message Date
Lokathor
93e9b53571
Merge pull request #17 from HeroicKatora/master
Add a method to allocate zeroed slices
2020-07-23 19:06:59 -06:00
Andreas Molzer
11e791c88a Add a method to allocate zeroed slices
Note that the method requires a Pod and not only a Zeroable structure
since only the latter guarantees that slices have a consistent layout.
We need to compute this layout to manually allocate it.
2020-07-23 22:10:49 +02:00
Lokathor
fa686336e7 factor the panic to one spot. 2020-02-06 19:38:05 -07:00
Lokathor
cd8ed37eae Remove the unreachable_unchecked 2020-02-06 19:18:10 -07:00
Lokathor
326c78d127 formatting 2020-02-04 00:20:12 -07:00
Lokathor
c0c3b38025 eliminate some dead branches 2020-02-04 00:18:22 -07:00
Lokathor
6feac18319
Merge pull request #15 from thomcc/transparent
Add TransparentWrapper marker trait
2020-01-29 01:16:21 -07:00
Lokathor
f5d5523f77 Pod safety documentation change
The previous requirements were incorrect because I misunderstood how `repr(packed)` actually means `repr(Rust, packed)` rather than `repr(C, packed)` as I first assumed.
Closes https://github.com/Lokathor/bytemuck/issues/14
2020-01-29 01:08:14 -07:00
Thom Chiovoloni
e415a28966 Duplicate the doctests for the sake of miri 2020-01-11 08:01:58 -08:00
Thom Chiovoloni
f62e320bba Rework TransparentWrapper to not require that the wrapped type be public 2020-01-11 07:31:17 -08:00
Thom Chiovoloni
c383083c16 Add TransparentWrapper marker trait 2020-01-11 06:28:11 -08:00
Thom Chiovoloni
d9ca3306dd Add Contiguous trait 2019-12-11 19:04:23 -08:00
Thom Chiovoloni
ac3133170a Add a sound offset_of macro 2019-12-10 08:40:14 -08:00
Lokathor
93dade1ab1 documentation consistency 2019-12-06 12:31:51 -07:00
Simon Sapin
6e54fc51fb Add from_bytes, from_bytes_mut, try_from_bytes, try_from_bytes_mut
This can be useful when receiving a bytes buffer from I/O
2019-12-06 13:23:08 +01:00
Lokathor
de517daffa MaybeUninit has to wait for later. 2019-11-25 19:21:38 -07:00
Lokathor
91aeef0b45 much more docs. 2019-11-25 19:09:26 -07:00
Lokathor
af499f4c7c Remove .cast method usage and rustfmt 2019-11-25 18:46:23 -07:00
Lokathor
efc80f1c4d Update allocation.rs 2019-11-18 20:39:07 -07:00
Lokathor
fba68534dc more trait! 2019-11-10 23:41:41 -07:00
Lokathor
3fd763c764 Fix a Miri failure 2019-11-04 19:12:59 -07:00
Lokathor
79143a6295 cargo fmt is a strict one 2019-11-03 23:55:51 -07:00
Lokathor
af3f4404df document the failure case
Closes https://github.com/Lokathor/bytemuck/issues/3
2019-11-03 23:45:38 -07:00
Lokathor
15bbbb29fd docs 2019-11-03 23:39:06 -07:00
Lokathor
24ad0df209 Update zeroable.rs 2019-10-05 19:26:47 -06:00
Lokathor
55a4eef7b6 improve the ZST case 2019-09-21 17:39:37 -06:00
Lokathor
72d3ae2419 clarify when allocation related operations are available. 2019-09-21 17:33:36 -06:00
Lokathor
dad138dba3
guard against zero sized types with an error
We could update this to just not allocate in the future but I don't believe that the docs give us assurances in that area.
2019-09-20 13:05:09 -06:00
Lokathor
6fea4bfa58
make the deref explicit 2019-09-20 11:40:44 -06:00
Lokathor
40cb0d19c3
comments 2019-09-20 11:12:40 -06:00
Lokathor
d4fde53386
Update src/zeroable.rs
Co-Authored-By: Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>
2019-09-20 11:10:01 -06:00
Lokathor
ca902ff52d
mention repr(packed) 2019-09-20 11:09:33 -06:00
Lokathor
28603a3198
gotta mask that unsafe 2019-09-20 11:08:40 -06:00
Lokathor
cc0a6aa751
use a result 2019-09-20 11:06:50 -06:00
Lokathor
973ec91f79
typo, remove old imports 2019-09-20 11:05:33 -06:00
Lokathor
8cdf598be4 formatting 2019-09-20 09:10:03 -06:00
Lokathor
876da036e4 zeroed out boxes 2019-09-20 09:01:23 -06:00
Lokathor
427893ab9b same fix for as_mut 2019-09-20 08:20:18 -06:00
Lokathor
c7e124e641 Remove Arc and Rc support, they've got repr(rust) internals. 2019-09-20 00:52:55 -06:00
Lokathor
2b8ef93dee simplify reborrow 2019-09-20 00:32:35 -06:00
Lokathor
22e1b7a6f6 ralith says to slim down the error 2019-09-19 23:11:06 -06:00
Lokathor
372ad15af9 commentary fix 2019-09-19 22:53:35 -06:00
Lokathor
7584fb2d19 Update lib.rs 2019-09-19 22:19:38 -06:00
Lokathor
a1b7c21a65 Update allocation.rs 2019-09-19 22:15:17 -06:00
Lokathor
0bae2db1b8 no_std + alloc 2019-09-19 22:11:25 -06:00
Lokathor
a45102007c more 2019-09-19 21:35:09 -06:00
Lokathor
70da6d7a77 zeroable 2019-09-19 19:23:24 -06:00