7次发布

使用旧的Rust 2015

0.2.4 2019年7月19日
0.2.3 2016年8月30日
0.2.2 2016年5月27日
0.2.0 2015年12月7日
0.1.0 2015年9月10日

1846数据结构

Download history 1886/week @ 2024-03-13 1851/week @ 2024-03-20 2051/week @ 2024-03-27 4431/week @ 2024-04-03 2013/week @ 2024-04-10 1758/week @ 2024-04-17 952/week @ 2024-04-24 744/week @ 2024-05-01 681/week @ 2024-05-08 673/week @ 2024-05-15 726/week @ 2024-05-22 806/week @ 2024-05-29 896/week @ 2024-06-05 681/week @ 2024-06-12 709/week @ 2024-06-19 754/week @ 2024-06-26

3,151 每月下载量
2 个crates中使用(通过 rmodbus

MIT 许可证

35KB
383

fixedvec

Build Status Version License

fixedvec 是一个Rust库/crate,提供无堆版本的Rust向量类型。虽然比libstd版本有限,但fixedvec为嵌入式系统或其他无法依赖堆的项目提供了急需的“管理”数组类型。

安装/使用

fixedvec 已针对当前的稳定版、beta版和nightly版进行了测试,以及前两个稳定Rust版本。

在稳定Rust中,#![no_std] 属性是可用的,但构建不带libstd的二进制文件仍然需要nightly编译器。

要使用 fixedvec,将以下内容添加到您的 Cargo.toml

[dependencies]
fixedvec = "*"

然后添加以下内容到您的crate根目录

#[macro_use] extern crate fixedvec;

示例

缓冲和修改字节数组列表

#[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]);
}

许可证

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.

无运行时依赖项

功能