Giter Club home page Giter Club logo

primitive-map-rs's Introduction

Primitive Map

Build Status Docs.rs Crates.io

primitive-map-rs's People

Contributors

mersinvald avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

baitcenter

primitive-map-rs's Issues

retain methods

Implementation of retain is blocked by #10 because of type difference

Implement all stdlib Map APIs

  • insert
  • get
  • get_mut
  • get_key_value
  • remove
  • remove_entry
  • contains_key
  • keys
  • values
  • values_mut
  • iter
  • iter_mut
  • len
  • is_empty
  • drain
  • clear
  • into_iter
  • Entry API #9
    retain #12 postponed

Fix possible invariant breakage in iter_mut

Currently PrimitiveMap::iter_mut returns Option<&mut (Key, Value)>, that makes it possible to mutate the Key and break the invariant leading to failing lookups by a new value of the Key.

Even anyone who is familiar with principals of HashMap data structure won't try to do so, it should be restricted by the API by returning Option<(Key, &mut Value)> from the iterator.

In the current iterators implementation, the native IntoIterators of used underlying data structures are used, so the solution might be in wrapping Buckets into new types and reimplementing the IntoIterator trait for them with more strict mutation constrains.

BST Vec bucket to replace current Vec and SmallVec buckets

BST layered on a Vec/SmallVec structure with map interface should be the default for PrimitiveMap buckets.

Fitstly, it will support immutable keys in iterators to solve the problems described in #10.
Secondly, it should improve performance, as both insertion and querying of entries if O(logn), compared to Vec/SmallVec's O(n) as both operations require looking up the element with the equal key.

dev-dependencies

Move all benchmarking and test deps into dev deps, make conditional compilation annotations.

Avoid runtime panic in BucketStoreNew

Currently, both new and with_capacity methods are described in the BucketStoreNew.
It is implemented by Vec which can implement both, and by Array which can't accept arbitrary capacity in runtime, so it panics at runtime.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.