nicholasbishop / ext4-view-rs

Rust library for reading ext2/ext4 filesystems
https://crates.io/crates/ext4-view
Apache License 2.0
8 stars 2 forks source link

Make the Ext4 struct cheap to clone #205

Closed nicholasbishop closed 2 months ago

nicholasbishop commented 2 months ago

The internal fields of Ext4 are now in a new Ext4Inner struct, which Ext4 stores in an Rc (think shared_ptr in C++ terms, but single-threaded).

This will allow Ext4 to be cheaply passed around by cloning it rather than with a reference, which in turn means that other structs can access the filesystem without having a lifetime parameter. That will (in future commits) make it possible to drop the lifetime param from ReadDir, and to add more functionality to DirEntry without adding a lifetime param.