Due to Rust's memory model, the current implementation uses a lot of repetitive code to support Mutable and immutable methods. So, we want clean this duplicated codes.
In particular, we will introduce a new generic parameter type BorrowType for static dispatch different methods between Mut and Immut.
In high-level, the basic idea is shown below:

Due to Rust's memory model, the current implementation uses a lot of repetitive code to support Mutable and immutable methods. So, we want clean this duplicated codes.
In particular, we will introduce a new generic parameter type
BorrowTypefor static dispatch different methods betweenMutandImmut.In high-level, the basic idea is shown below: