-
Notifications
You must be signed in to change notification settings - Fork 209
Open
Description
It would be nice to have a method for getting the memory consumption of BigInt
s and BigUInt
s. In particular this crate is being used by RustPython, and the python spec requires builtins to implement a __sizeof__
method that returns the amount of memory used by an object in bytes. This is quite easy to calculate using std::mem::size_of_val
, unfortunately it requires a reference to the underlying data
Vec, which of course is not exposed by the BigInt
api.
My proposal is to either:
- Add a method for getting a reference to
data
or - Add a method for getting the size of
BigInt
/BigUInt
I would prefer the first option because it will support a lot more unforseen use cases.
See the discussion at RustPython/RustPython#1172
windelbouwman and ClementNerma
Metadata
Metadata
Assignees
Labels
No labels