You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A blanket impl of DeepSize for all copy types would cover a significant amount of the library comparability code in this library. Can Copy types own memory, in the sense that this library tracks?
The only type that I can think of that that conflicts with this are references; they are currently defined to not measure the referenced structure, but other structures may want special logic for that.
One way to solve it would be with specialization and a default impl of DeepSize for types with Copy, but that's still a long way off. The other would be to just make a normal impl (which would be a breaking change) and hope that no one runs into cases where a specialized implementation is needed.
The text was updated successfully, but these errors were encountered:
would be really great. The problem here is that this, sadly, doesn't work due to those pesky coherence rules:
error[E0119]: conflicting implementations of trait `DeepSizeOf` for type `std::path::PathBuf`
--> src/lib.rs:51:1
|
51 | impl<T: Copy> DeepSizeOf for T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::path::PathBuf`
|
::: src/default_impls.rs:90:5
|
90 | impl DeepSizeOf for PathBuf {
| --------------------------- first implementation here
|
= note: upstream crates may add a new impl of trait `std::marker::Copy` for type `std::path::PathBuf` in future versions
BUT! It seems we can use auroref specialization in the deref macro to a similar effect!
A blanket impl of
DeepSize
for all copy types would cover a significant amount of the library comparability code in this library. CanCopy
types own memory, in the sense that this library tracks?The only type that I can think of that that conflicts with this are references; they are currently defined to not measure the referenced structure, but other structures may want special logic for that.
One way to solve it would be with specialization and a default impl of
DeepSize
for types withCopy
, but that's still a long way off. The other would be to just make a normal impl (which would be a breaking change) and hope that no one runs into cases where a specialized implementation is needed.The text was updated successfully, but these errors were encountered: