Skip to content

Types naming #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true

validate:
name: wait for jobs
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# StaticVector
# Static Vector

[![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![build](https://github.com/andreiavrammsd/static_vector.rs/workflows/CI/badge.svg)](https://github.com/andreiavrammsd/static_vector.rs/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/andreiavrammsd/static_vector.rs/graph/badge.svg?token=pCcpya0mZC)](https://codecov.io/gh/andreiavrammsd/static_vector.rs)

A no-std, stack-allocated vector with fixed capacity and dynamic length.

[`StaticVector`] stores elements on the stack using a fixed-size array without heap allocations.
[`Vec`] stores elements on the stack using a fixed-size array without heap allocations.

Aims to be suitable for low-level projects and to have an API as safe and explicit as possible.
The goal is to allocate only when needed. When first constructed, the vector will not allocate.
Expand All @@ -21,8 +21,8 @@ The goal is to allocate only when needed. When first constructed, the vector wil

## Requirements

- `T: Clone` for insertion: [`StaticVector::push()`]
- `T: Default` only if [`StaticVector::set_len()`] is used
- `T: Clone` for insertion: [`Vec::push()`]
- `T: Default` only if [`Vec::set_len()`] is used
- `CAPACITY > 0`

## Complexity
Expand All @@ -37,9 +37,9 @@ All operations are O(1) except:
## Example

```rust
use static_vector::StaticVector;
use static_vector::Vec;

let mut vec = StaticVector::<i32, 3>::new();
let mut vec = Vec::<i32, 3>::new();

vec.push(&4).unwrap();
vec.push(&5).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions benches/static_vector.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use criterion::{Criterion, criterion_group, criterion_main};
use static_vector::StaticVector;
use static_vector::Vec;

fn bench_static_vector(c: &mut Criterion) {
let mut vec = StaticVector::<i32, 10>::new();
let mut vec = Vec::<i32, 10>::new();

c.bench_function("push and clear", |b| {
b.iter(|| {
Expand Down
8 changes: 6 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ coverage:
status:
patch:
default:
threshold: 100
target: 100%
threshold: 0%
if_ci_failed: error
project:
default:
threshold: 100
target: 100%
threshold: 0%
if_ci_failed: error
Loading