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
The standard way of representing an LRU is to have nodes be stored in a hashmap or binary search tree, with lookup-by-key, and in a linked-list which represents recency. This allows O(1) or O(logn) lookup/insert time, and constant time update/eviction with the recency list.
This is more difficult to represent in Rust. You could do it with @mut pointers, but we all know what would go wrong there, and also that would prevent you from sharing it between tasks. You could also do it with unsafe pointers. I suggest instead representing it as a vector, and replacing the pointers with indices into the vector.
The text was updated successfully, but these errors were encountered:
This is also the same data structure as OrderedDict in python and LinkedHashMap, they provide both the LRU cache use case and also a hash map recording the insertion order.
Ignore references to type aliases in ptr_arg
Works using the fact that the hir path will point to a TyAlias, rather than being resolved to the underlying type
Fixesrust-lang#7699
changelog: [`ptr_arg`] No longer lints references to type aliases
The standard way of representing an LRU is to have nodes be stored in a hashmap or binary search tree, with lookup-by-key, and in a linked-list which represents recency. This allows O(1) or O(logn) lookup/insert time, and constant time update/eviction with the recency list.
The representation is usually something like:
This is more difficult to represent in Rust. You could do it with
@mut
pointers, but we all know what would go wrong there, and also that would prevent you from sharing it between tasks. You could also do it with unsafe pointers. I suggest instead representing it as a vector, and replacing the pointers with indices into the vector.The text was updated successfully, but these errors were encountered: