All Projects → rust-embedded → fixedvec-rs

rust-embedded / fixedvec-rs

Licence: other
Heapless vector implementation for Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to fixedvec-rs

Cortex M Rtic
Real-Time Interrupt-driven Concurrency (RTIC) framework for ARM Cortex-M microcontrollers
Stars: ✭ 623 (+1497.44%)
Mutual labels:  no-std
Utest
Unit `#[test]`ing for microcontrollers and other `no_std` systems
Stars: ✭ 119 (+205.13%)
Mutual labels:  no-std
mfrc522
A platform agnostic driver to interface the MFRC522 (RFID reader/writer)
Stars: ✭ 27 (-30.77%)
Mutual labels:  no-std
Byte
A low-level, zero-copy, panic-free, binary serializer and deserializer. (parser and encoder)
Stars: ✭ 29 (-25.64%)
Mutual labels:  no-std
Governor
A rate-limiting library for Rust (formerly ratelimit_meter)
Stars: ✭ 99 (+153.85%)
Mutual labels:  no-std
Auto enums
A library for to allow multiple return types by automatically generated enum.
Stars: ✭ 188 (+382.05%)
Mutual labels:  no-std
Serde
Serialization framework for Rust
Stars: ✭ 4,901 (+12466.67%)
Mutual labels:  no-std
register-rs
Unified interface for type-safe MMIO and CPU register access in Rust
Stars: ✭ 48 (+23.08%)
Mutual labels:  no-std
Drone
CLI utility for Drone, an Embedded Operating System.
Stars: ✭ 114 (+192.31%)
Mutual labels:  no-std
Staticvec
Implements a fixed-capacity stack-allocated Vec alternative backed by an array, using const generics.
Stars: ✭ 236 (+505.13%)
Mutual labels:  no-std
Rhai
Rhai - An embedded scripting language for Rust.
Stars: ✭ 958 (+2356.41%)
Mutual labels:  no-std
Bitmatch
A Rust crate that allows you to match, bind, and pack the individual bits of integers.
Stars: ✭ 82 (+110.26%)
Mutual labels:  no-std
Beef
Faster, more compact implementation of std::borrow::Cow
Stars: ✭ 189 (+384.62%)
Mutual labels:  no-std
Xargo
The sysroot manager that lets you build and customize `std`
Stars: ✭ 841 (+2056.41%)
Mutual labels:  no-std
stm32f103xx
DEPRECATED
Stars: ✭ 31 (-20.51%)
Mutual labels:  no-std
Heapless
Heapless, `static` friendly data structures
Stars: ✭ 575 (+1374.36%)
Mutual labels:  no-std
Pin Project
A crate for safe and ergonomic pin-projection.
Stars: ✭ 174 (+346.15%)
Mutual labels:  no-std
alloc-cortex-m
A heap allocator for Cortex-M processors
Stars: ✭ 139 (+256.41%)
Mutual labels:  no-std
rust-amplify
Amplifying Rust language capabilities: multiple generic trait implementations, type wrappers, bit-precise numerics, derive macros
Stars: ✭ 38 (-2.56%)
Mutual labels:  no-std
Rust Lexical
Lexical, to- and from-string conversion routines.
Stars: ✭ 192 (+392.31%)
Mutual labels:  no-std

fixedvec

Build Status Version License

fixedvec is a Rust library/crate providing a heapless version of the Rust vector type. Although more limited than the libstd version, fixedvec provides a much-needed "managed" array type for embedded systems or other projects that cannot rely on the heap.

Install/Use

fixedvec is tested against the current stable, beta, and nightly, as well as the previous two stable Rust releases.

The #![no_std] attribute is available in stable Rust, but building binaries without libstd still requires the nightly compiler.

To use fixedvec, add the following to your Cargo.toml:

[dependencies]
fixedvec = "*"

Then add the following to your crate root:

#[macro_use] extern crate fixedvec;

Example

Buffering and mutating a list of bytes:

#[macro_use] extern crate fixedvec;

use fixedvec::FixedVec;

fn main() {
    let mut preallocated_space = alloc_stack!([u8; 10]);
    let mut vec = FixedVec::new(&mut preallocated_space);
    assert_eq!(vec.len(), 0);

    vec.push_all(&[1, 2, 3]).unwrap();
    assert_eq!(vec.len(), 3);
    assert_eq!(vec.as_slice(), &[1, 2, 3]);

    vec.map_in_place(|x: &mut u8| { *x *= 2 });
    assert_eq!(vec.as_slice(), &[2, 4, 6]);
}

Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.23.0 and up. It might compile with older versions but that may change in any new patch release.

License

Copyright (c) 2015-2016, Nick Stevens <[email protected]>

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].