Coder Social home page Coder Social logo

bits0rcerer / quantum-ring Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 696 KB

๐Ÿ’  An easy-to-use low-level ring buffer implementation that leverages virtual address space trickery for Rust ๐Ÿฆ€

License: MIT License

Rust 100.00%
async buffer io linux low-level mmap ring-buffer rust tokio

quantum-ring's Introduction

๐Ÿ’  Quantum Ring ๐Ÿ’ 

An easy-to-use low-level ring buffer implementation that leverages virtual address space trickery for Rust ๐Ÿฆ€

How to

  • Create a new QuantumRing with a size
    • size will be treated as a lower boundary. The actual size may be greater, because the buffer has to be page aligned.
    let qring = QuantumRing::new_with_size(1024, PageSizes::all())
                  .expect("unable to create QuantumRing");
  • Read/Write
    • Read using direct access
    let slice: &[u8] = qring.read_slice();
    // do something with 0 <= n < slice.len() == qring.read_len() bytes
    unsafe { qring.advance_read(n) };
    • Write using direct access
    let slice: &mut [u8] = qring.write_slice();
    // overwrite 0 <= n < slice.len() == qring.write_len() bytes from slice
    unsafe { qring.advance_write(n) };
    • QuantumRing implements std::io::Read
    • QuantumRing implements std::io::Write
    • QuantumRing implements futures_io::AsyncRead (feature: futures)
    • QuantumRing implements futures_io::AsyncWrite (feature: futures)
    • QuantumRing implements tokio_io::AsyncRead (feature: tokio)
    • QuantumRing implements tokio_io::AsyncWrite (feature: tokio)

quantum-ring's People

Contributors

bits0rcerer avatar

Stargazers

 avatar Shabbir Hasan avatar ekis avatar

Watchers

 avatar

Forkers

shabbirhasan1

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.