Absolucy / Absolucy/nanorand-rs

How does/does fill() work at all ?

Đang mở
#49 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
251
Fork
24
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I was trying to generate some uuids and it seems that fill() just takes mutable references to temporary copies of the bytes in an array. I have to map the initial zeroed array and just use generate() to get it to work.
```rust
let mut rng = nanorand::tls_rng();
let random_bytes = [0; 16];
let random_bytes = random_bytes.map(|_| rng.generate::());
```
the above works
```rust
rng.fill(random_bytes);
rng.fill_bytes(random_bytes);
```
the above two do nothing, regardless of the declared mutability of `random_bytes`

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.