nt-hive icon indicating copy to clipboard operation
nt-hive copied to clipboard

nt-hive depends on external `trait`

Open janstarke opened this issue 4 years ago • 0 comments

nt-hive depends on zerocopy::ByteSlice, which seemed to be a good idea. Unfortunately, zerocopy::ByteSlice is Sealed, which means that no one can implement that trait for oneself.

Especially for Windows registry files, which can be very large, using memmap::Mmap can speed things up a lot, but it is not possible to implement zerocopy::ByteSlice for a custom type based on memmap::Mmap. Really? Sure, it is! One must fork zerocopy AND nt-hive, remove the Sealed marker, make nt-hive use the modified zerocopy and there you are. (example: https://github.com/janstarke/regview/blob/nt-hive/src/mmap_byteslice.rs) The problem here is that nt-hive depends on a foreign trait, which cannot easily be enhanced (I didn't even find a way to contact the maintainer).

My wish was that you provide an own ByteSlice trait, which can be implemented by the consumer of nt-hive. Was that OK for you? Yes, you cannot be sure that there are really no copy operation, but that would be the performance impact of the consumer. In my eyes ;-)

janstarke avatar Jan 14 '22 12:01 janstarke