# ADR-001: Safe Rust ## Context Rust allows us to use unsafe constructions in order to optimize data structures and calls. Tree structures, double linked lists etc. can be created using raw pointers, and open the way to faster algorithms. However, many standard implementations of these data structures are sufficient, and often the extra degree of freedom in the data structure results in less optimal cache behaviour, nullifying the speed gain. ## Decision We will not use unsafe rust in our own code. ## Status Accepted ## Consequences We will fallback to cargo packages that implement standard algorithms. ### No unsafe optimizations We will not optimize beyond what is attainable using safe rust. We might optimize further at a later time, but for now we should focus on the low hanging fruit and proven stable structures. This way, we will focus on the completion of the Phreak algorithm itself, instead of micro-managing the underlying data structures. ### Tree structures We will use the generational-indextree::Arena type for storage of all Tree based types, such as BetaNodes and Tokens.