Skip to content

Commit

Permalink
crated turned into no_std
Browse files Browse the repository at this point in the history
  • Loading branch information
orxfun committed Sep 8, 2024
1 parent a7e82ee commit e27e903
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "orx-concurrent-vec"
version = "2.6.0"
version = "2.7.0"
edition = "2021"
authors = ["orxfun <[email protected]>"]
description = "An efficient, convenient and lightweight grow-only read & write concurrent data structure allowing high performance concurrent collection."
Expand All @@ -10,11 +10,11 @@ keywords = ["concurrency", "vec", "data-structures", "atomic", "lock-free"]
categories = ["data-structures", "concurrency", "rust-patterns"]

[dependencies]
orx-pseudo-default = "1.4"
orx-pinned-vec = "3.7"
orx-fixed-vec = "3.7"
orx-split-vec = "3.7"
orx-pinned-concurrent-col = "2.6"
orx-pseudo-default = { version = "1.4", default-features = false }
orx-pinned-vec = "3.8"
orx-fixed-vec = "3.8"
orx-split-vec = "3.8"
orx-pinned-concurrent-col = "2.7"
orx-concurrent-option = "1.1"

[dev-dependencies]
Expand Down
7 changes: 4 additions & 3 deletions src/common_traits/debug.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::ConcurrentVec;
use core::fmt::Debug;
use orx_concurrent_option::ConcurrentOption;
use orx_fixed_vec::IntoConcurrentPinnedVec;
use std::fmt::Debug;

const ELEM_PER_LINE: usize = 8;

Expand All @@ -10,7 +10,7 @@ where
P: IntoConcurrentPinnedVec<ConcurrentOption<T>>,
T: Debug,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let len = self.len();
let capacity = self.capacity();

Expand All @@ -35,12 +35,13 @@ where
#[cfg(test)]
mod tests {
use super::*;
extern crate alloc;

#[test]
fn debug() {
let vec = ConcurrentVec::new();
vec.extend([0, 4, 1, 2, 5, 6, 32, 5, 1, 121, 2, 42]);
let dbg_str = format!("{:?}", &vec);
let dbg_str = alloc::format!("{:?}", &vec);
assert_eq!(dbg_str, "ConcurrentVec {\n len: 12,\n capacity: 12,\n data: [,\n 0, 4, 1, 2, 5, 6, 32, 5, \n 1, 121, 2, 42, \n ],\n}");
}
}
2 changes: 1 addition & 1 deletion src/common_traits/index.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::ConcurrentVec;
use core::ops::{Index, IndexMut};
use orx_concurrent_option::ConcurrentOption;
use orx_pinned_vec::IntoConcurrentPinnedVec;
use std::ops::{Index, IndexMut};

pub(crate) const OUT_OF_BOUNDS: &str = "index out of bounds";

Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
clippy::missing_panics_doc,
clippy::todo
)]
#![no_std]

mod common_traits;
mod new;
Expand Down
12 changes: 6 additions & 6 deletions src/state.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use orx_concurrent_option::ConcurrentOption;
use orx_pinned_concurrent_col::{ConcurrentState, PinnedConcurrentCol, WritePermit};
use orx_pinned_vec::{ConcurrentPinnedVec, PinnedVec};
use std::{
use core::{
cmp::Ordering,
sync::atomic::{self, AtomicUsize},
};
use orx_concurrent_option::ConcurrentOption;
use orx_pinned_concurrent_col::{ConcurrentState, PinnedConcurrentCol, WritePermit};
use orx_pinned_vec::{ConcurrentPinnedVec, PinnedVec};

#[derive(Debug)]
pub struct ConcurrentVecState {
Expand Down Expand Up @@ -59,8 +59,8 @@ impl<T> ConcurrentState<ConcurrentOption<T>> for ConcurrentVecState {
let last_idx = begin_idx + num_items - 1;

match (begin_idx.cmp(&capacity), last_idx.cmp(&capacity)) {
(_, std::cmp::Ordering::Less) => WritePermit::JustWrite,
(std::cmp::Ordering::Greater, _) => WritePermit::Spin,
(_, core::cmp::Ordering::Less) => WritePermit::JustWrite,
(core::cmp::Ordering::Greater, _) => WritePermit::Spin,
_ => WritePermit::GrowThenWrite,
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/vec.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::state::ConcurrentVecState;
use core::sync::atomic::Ordering;
use orx_concurrent_option::ConcurrentOption;
use orx_pinned_concurrent_col::PinnedConcurrentCol;
use orx_pinned_vec::IntoConcurrentPinnedVec;
use orx_split_vec::{Doubling, SplitVec};
use std::sync::atomic::Ordering;

/// An efficient, convenient and lightweight grow-only read & write concurrent data structure allowing high performance concurrent collection.
///
Expand Down

0 comments on commit e27e903

Please sign in to comment.