GithubHelp home page GithubHelp logo

tempbottle / rust-membuf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from reem/rust-membuf

0.0 1.0 0.0 121 KB

A safe-ish wrapper for allocating, reallocating and deallocating heap buffers.

Rust 100.00%

rust-membuf's Introduction

membuf

A safe-ish wrapper for allocating, reallocating and deallocating heap buffers.

Overview

A safe wrapper around a heap allocated buffer of Ts, tracking capacity only.

MemBuf makes no promises about the actual contents of this memory, that's up to the user of the structure and can be manipulated using the standard pointer utilities, accessible through the impl of Deref<Target=*mut T> for MemBuf<T>.

You can think of MemBuf<T> as an approximation for Box<[T]> where the elements are not guaranteed to be valid/initialized. It is meant to be used as a building block for other collections, so they do not have to concern themselves with the minutiae of allocating, reallocating, and deallocating memory.

However, note that MemBuf<T> does not have a destructor, and implements Copy, as a result, it does not implement Send or Sync, and it is the responsibility of the user to call deallocate if they wish to free memory.

There is also a UniqueBuf<T> which does not implement Copy, implements Send and Sync, and has a destructor responsible for deallocation.

Usage

Use the crates.io repository; add this to your Cargo.toml along with the rest of your dependencies:

[dependencies]
membuf = "*"

Author

Jonathan Reem is the primary author and maintainer of membuf.

License

MIT

rust-membuf's People

Contributors

reem avatar

Watchers

 avatar

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.