Git Product home page Git Product logo

slots's Introduction

Slots crates.io build status codecov

This crate provides a heapless slab allocator with strict access control.

Slots implements a static friendly, fixed size, unordered data structure inspired by SlotMap. All operations are constant time.

Documentation

Features

  • Slots provide the runtime_checks feature that can be used to disable key owner verification. By default the feature is on and it is recommended to leave it enabled for development builds and disabled for release builds.

    Note: This feature requires atomic instructions, which are not generally available (for example, on ARM Cortex-M0 microcontrollers)

slots's People

Contributors

bugadani avatar chrysn avatar

Stargazers

mcoms avatar Aram Peres avatar

Watchers

James Cloos avatar  avatar  avatar

slots's Issues

1.0 ideas and tracking

Use this issue to collect issues, ideas towards a 1.0 release.

Current open topics:

  • Naming. The inclusion of SlotMap will make the Slots name even less descriptive and useful.

To Do:

  • Fixed size SlotMap implementation based on this talk
  • Optimize the next_free member (#13)
  • Iterator support (Relaxed may have mutable)
  • Less cluttered API (#12)
  • Option for a more relaxed access mode (#10 or #11 #17)
  • Documentation improvements

Make key externally constructable

As this data structure verifies, on access, whether the indicated element is actually allocated (and because keys can outlive their elements anyway -- after all, they are keys and not cursors), it would be convenient to allow a key to be deserialized. Making new public would achieve that, as would a from_index constructor that (unlike new) pre-verifies that the index is within the size range (which might be better than new as it'd allow migration to internal N-dependent size types or even value-limited types as those features become available in Rust).

The particular use case I have in mind for this is the collection pattern of webservers -- it receives a POST, picks a new resource name based on the slots index, and makes that resource accessible until it gets DELETEd. When the client comes back to access or deletes the resource, it passes the key in as a path component.

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.