rust-vmm / vm-memory

Virtual machine's guest memory crate
Apache License 2.0
299 stars 97 forks source link

Drop Default requirement on ByteValued #274

Closed Ablu closed 8 months ago

Ablu commented 8 months ago

Since zeros are a valid value for any ByteValued type, we can use that instead of relying on a Default implementation (which may not be auto-derivable for some array types).

Further optimizations would be possible if we would have access to a pointer value into the source data. Then we could also use ptr::copy_nonoverlapping and avoid pre-initialization altogether. But changing the API just for that seems a bit excessive.

Requirements

Before submitting your PR, please make sure you addressed the following requirements: