Macro memory_cost_structural_copy

Source
macro_rules! memory_cost_structural_copy {
    { $($ty:ty),* $(,)? } => { ... };
}
Expand description

Implement HasMemoryCostStructural for Copy types

The indirect_memory_cost of a Copy + 'static type is zero.

This macro implements that.

Ideally, we would impl <T: Copy + 'static> MemoryCostStructural for T. But that falls foul of trait coherence rules. So instead we provide memory_cost_structural_copy! and the #[deftly(has_memory_cost(copy))] attribute.

This macro can only be used within tor-memquota, or for types local to your crate. For other types, use #[deftly(has_memory_cost(copy))] on each field of that type.