1//! **arrayvec** provides the types [`ArrayVec`] and [`ArrayString`]:
2//! array-backed vector and string types, which store their contents inline.
3//!
4//! The arrayvec package has the following cargo features:
5//!
6//! - `std`
7//! - Optional, enabled by default
8//! - Use libstd; disable to use `no_std` instead.
9//!
10//! - `serde`
11//! - Optional
12//! - Enable serialization for ArrayVec and ArrayString using serde 1.x
13//!
14//! - `zeroize`
15//! - Optional
16//! - Implement `Zeroize` for ArrayVec and ArrayString
17//!
18//! ## Rust Version
19//!
20//! This version of arrayvec requires Rust 1.51 or later.
21//!
22#![doc(html_root_url="https://docs.rs/arrayvec/0.7/")]
23#![cfg_attr(not(feature="std"), no_std)]
24
25#[cfg(feature="serde")]
26extern crate serde;
27
28#[cfg(not(feature="std"))]
29extern crate core as std;
30
31pub(crate) type LenUint = u32;
32
33macro_rules! assert_capacity_limit {
34 ($cap:expr) => {
35 if std::mem::size_of::<usize>() > std::mem::size_of::<LenUint>() {
36 if $cap > LenUint::MAX as usize {
37 panic!("ArrayVec: largest supported capacity is u32::MAX")
38 }
39 }
40 }
41}
42
43macro_rules! assert_capacity_limit_const {
44 ($cap:expr) => {
45 if std::mem::size_of::<usize>() > std::mem::size_of::<LenUint>() {
46 if $cap > LenUint::MAX as usize {
47 [/*ArrayVec: largest supported capacity is u32::MAX*/][$cap]
48 }
49 }
50 }
51}
52
53mod arrayvec_impl;
54mod arrayvec;
55mod array_string;
56mod char;
57mod errors;
58mod utils;
59
60pub use crate::array_string::ArrayString;
61pub use crate::errors::CapacityError;
62
63pub use crate::arrayvec::{ArrayVec, IntoIter, Drain};
64