aejenk / glitchup

A databender library/executable made in Rust.
Mozilla Public License 2.0
1 stars 0 forks source link

Add Loader to abstract use of memmap #8

Closed aejenk closed 5 years ago

aejenk commented 5 years ago

If someone is unfamiliar with memmap, they would need to learn how it works.

An additional point is that the memmap object might not even be required after the loading has occured. This is unsure, but if confirmed during testing, then &mut *mmap could be returned instead.

This Loader object will have the following functions:

copy_file simply copies the file, map_file_mut mutably memory maps the file into memory, returning the map, or a reference, and init_file_for_mut performs both functions at once.

aejenk commented 5 years ago

Additional functions such as load_file_into_string could be implemented later on, for example to parse an option file.