Skip to content
Snippets Groups Projects
  • Yaroslav Dynnikov's avatar
    31a76282
    feature: KVCell data strcture · 31a76282
    Yaroslav Dynnikov authored
    `KVCell` contains an optional value and provides access by key in two
    flavors:
    
    ```rust
    fn take_or_drop(&mut self, key: &K) -> Option<T>
    fn take_or_keep(&mut self, key: &K) -> Option<T>
    ```
    
    Both return `Some` value only if provided key matches the contained one.
    
    The behavior differs when the provided key doesn't match:
    - `take_or_drop` always leaves the cell empty. It supersedes
      `CachedCell` and copies its behavior.
    - `take_or_keep` retains contained value. It's a replacement for
      `JointStateLatch`.
    31a76282
    History
    feature: KVCell data strcture
    Yaroslav Dynnikov authored
    `KVCell` contains an optional value and provides access by key in two
    flavors:
    
    ```rust
    fn take_or_drop(&mut self, key: &K) -> Option<T>
    fn take_or_keep(&mut self, key: &K) -> Option<T>
    ```
    
    Both return `Some` value only if provided key matches the contained one.
    
    The behavior differs when the provided key doesn't match:
    - `take_or_drop` always leaves the cell empty. It supersedes
      `CachedCell` and copies its behavior.
    - `take_or_keep` retains contained value. It's a replacement for
      `JointStateLatch`.