Giter Site home page Giter Site logo

acid_io's Introduction

acid_io

A pared-down version of Rust's std::io usable in no_std contexts.


Rust's std::io provides common interfaces that are used widely in the Rust ecosystem for reading and writing data. However, as of 2022, these interfaces are not available in no_std builds.

This crate provides drop-in replacements for the types and traits exposed by std::io which can be used with no_std.

Example

#![no_std]

use acid_io::{
    byteorder::{BE, LE, ReadBytesExt, WriteBytesExt},
    Cursor, Read, Seek, SeekFrom, Write,
};

let mut buf = [0u8; 10];
let mut curs = Cursor::new(&mut buf);

curs.write_u8(1)?;
curs.write_u16::<BE>(2)?;
curs.write_u32::<LE>(3)?;

curs.seek(SeekFrom::Start(0))?;

assert_eq!(curs.read_u8()?, 1);
assert_eq!(curs.read_u16::<BE>()?, 2);
assert_eq!(curs.read_u32::<LE>()?, 3);

Feature flags

  • std

    Replaces all items with re-exports of their counterparts in std::io. This effectively makes acid_io an alias of std::io, but missing any items that acid_io wouldn't otherwise provide.

  • alloc

    Exposes BufReader and BufWriter, as well as those trait methods which take or return Vec or String.

  • byteorder

    Exposes acid_io::byteorder, which contains implementations of ReadBytesExt and WriteBytesExt for acid_io's Read and Write traits. Also re-exports the rest of byteorder.

Acknowledgments

Much of this library is copied verbatim or with slight modifications from other Rust projects:

If you find this crate useful, please consider sponsoring members of the Library team on GitHub.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

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.