Aeledfyr / deepsize

A rust crate to find the total size of an object, on the stack and on the heap
MIT License
103 stars 19 forks source link

Standard library types #7

Open dtolnay opened 5 years ago

dtolnay commented 5 years ago

Moved from https://github.com/dtolnay/request-for-implementation/issues/22#issuecomment-457410613:

Does anyone have preferences on which standard library types this is implemented for?

dtolnay commented 5 years ago

I wouldn't try to be exhaustive. People can send PRs for additional impls as they are needed.

Aeledfyr commented 5 years ago

Here is the current list of standard library types which I have implemented:

It would be nice if I could use the derive macro on foreign types, but since that doesn't work, if something doesn't allocate, I can just use known_deep_size!(0, ...) to implement it.

Are there any common collection or heap allocation types that I'm missing? One of the best ways to find what's missing would probably be to try to use it somewhere.

dtolnay commented 5 years ago

That seems like a good list to me! I would start with that and wait for users to report any additional types that they need support for.

droundy commented 4 years ago

I'd love to see BTreeSet and BTreeMap supported.

Aeledfyr commented 4 years ago

BTreeSet and BTreeMap are now implemented, along with all atomic integers and NonZero integers. I've also added some additional library support, and:

Mutability wrappers: Cell<T: Copy>, RefCell<T>, Mutex<T>, & RwLock<T> Weak reference counted pointers: rc::Weak<T> and sync::Weak<T>

I haven't implemented them yet, but I'm considering adding Path and PathBuf.