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
I understand that T: Send is a requirement for ThreadLocal to function, but could the Send bound be removed from the struct definition and just retained for method impls.
This would greatly simply generic struct definitions, which nest structs containing a ThreadLocal. Currently the Send bound propagates, even to impls of structs containing thread locals that don't make use of the actual thread local or any of its methods.
Obviously where methods of the ThreadLocal are called then the trait bound is needed.
Use case:
I have a struct A, which is contained in struct B, which is contained in struct C etc. If I add a ThreadLocal to A (to count method invocations say or method invocation timing metrics), then B, C and so on, all need to declare T:Send. As do trait impls such as impl Display for C, PAartialEq it seems.
The text was updated successfully, but these errors were encountered:
I understand that T: Send is a requirement for ThreadLocal to function, but could the Send bound be removed from the struct definition and just retained for method impls.
This would greatly simply generic struct definitions, which nest structs containing a ThreadLocal. Currently the Send bound propagates, even to impls of structs containing thread locals that don't make use of the actual thread local or any of its methods.
Obviously where methods of the ThreadLocal are called then the trait bound is needed.
Use case:
I have a struct A, which is contained in struct B, which is contained in struct C etc. If I add a ThreadLocal to A (to count method invocations say or method invocation timing metrics), then B, C and so on, all need to declare T:Send. As do trait impls such as impl Display for C, PAartialEq it seems.
The text was updated successfully, but these errors were encountered: