typesize offers a trait to calculate the total memory size used by a type (including heap allocations). This can be important for caches; PaperCache uses typesize to determine how much memory a particular key or value uses; the Discord library serenity can optionally use it to track the size of its cached data, and so on.
While typesize includes optional implementations for some external libraries like arrayvec or url, it's currently impossible to fully implement TypeSize support for jiff from outside the jiff crate, because of how TimeZone pointers work.
I "implemented" support for most of jiff's core types in GnomedDev/typesize#10 (because for a wholly stack-based type the implementation can use default methods):
impl TypeSize for jiff::SignedDuration {}
impl TypeSize for jiff::Timestamp {}
// etc
However, the typesize dev would prefer to have the support be implemented in the jiff crate (which I can understand, since that will make it easier to keep up to date). And of course if we're going to have an implementation at all, it would be nice to support TimeZone.
If you're willing to accept a PR for this, I'd be happy to draft one.
typesizeoffers a trait to calculate the total memory size used by a type (including heap allocations). This can be important for caches; PaperCache usestypesizeto determine how much memory a particular key or value uses; the Discord libraryserenitycan optionally use it to track the size of its cached data, and so on.While
typesizeincludes optional implementations for some external libraries likearrayvecorurl, it's currently impossible to fully implementTypeSizesupport forjifffrom outside thejiffcrate, because of howTimeZonepointers work.I "implemented" support for most of
jiff's core types in GnomedDev/typesize#10 (because for a wholly stack-based type the implementation can use default methods):However, the
typesizedev would prefer to have the support be implemented in thejiffcrate (which I can understand, since that will make it easier to keep up to date). And of course if we're going to have an implementation at all, it would be nice to supportTimeZone.If you're willing to accept a PR for this, I'd be happy to draft one.