Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
495: [Closes #443] Safe list that does not own its nodes r=Medowhill a=travis1829 Closes #443 #443 을 `Branded`를 사용하지 않는 다른 방법으로 해결해보았습니다. 핵심은 다음과 같습니다. * `NodeRef`, `NodeMut`는 `Node`가 `List` 안에 있는 동안에만 존재합니다. * `NodeRef`를 얻으려면, 항상 1) `NodeRef`와 2) `ListRef`가 둘다 필요합니다. * `NodeMut`를 얻으려면, 항상 1) `NodeMut`와 2) `ListMut`가 둘다 필요합니다. * 하나의 `List`에 대해, `NodeMut`는 항상 단 한개만 존재합니다. * `Node`가 `List`안에 있는 상태에서 drop되면 panic합니다. (유일한 runtime cost) 이렇게 하면, lifetime 제한이나 functionality 제한 등을 걸지 않더라도 linked list를 safe하게 구현할 수 있습니다. Co-authored-by: travis1829 <travis1829@naver.com>
- Loading branch information