shared_vec/
lib.rs

1#![no_std]
2#![doc = include_str!("../README.md")]
3
4extern crate alloc;
5
6#[cfg(feature = "std")]
7extern crate std;
8
9use core::cell::Cell;
10use core::sync::atomic::AtomicUsize;
11
12mod counter;
13mod impls;
14mod inner;
15mod string;
16mod vec;
17
18pub use counter::Counter;
19pub use string::String;
20pub use vec::Vec;
21
22/// Type alias for a reference-counted [Vec] using [`Cell<usize>`] as the counter.
23pub type RcVec<T> = Vec<Cell<usize>, T>;
24/// Type alias for an atomically reference-counted [Vec] using [`AtomicUsize`] as the counter.
25pub type ArcVec<T> = Vec<AtomicUsize, T>;
26/// Type alias for a reference-counted [String] using [`Cell<usize>`] as the counter.
27pub type RcString = String<Cell<usize>>;
28/// Type alias for an atomically reference-counted [String] using [`AtomicUsize`] as the counter.
29pub type ArcString = String<AtomicUsize>;