danielhenrymantilla / rust-uninit

Read trait fixed to soundly work with uninitalized memory
MIT License
25 stars 2 forks source link

Rename `init_with` to `fill_with`, add a `fill` method #26

Closed kupiakos closed 10 months ago

kupiakos commented 10 months ago

This would make it much easier to understand and switch from &mut [u8] to Out<[u8]>

kupiakos commented 10 months ago

Ah, there's a key distinction between init_with and fill_with: fill_with takes a FnMut() -> T while init_with takes an IntoIterator<Item = T>. The former guarantees that everything is filled. iter::from_fn plus a per-item unwrap is equivalent to the FnMut() -> T.

The planned change: