Debian Codegraph @

.cargo/vendor/arrayvec/src/lib.rs

raw
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")]
26 extern crate serde;
27
28 #[cfg(not(feature="std"))]
29 extern crate core as std;
30
31 pub(crate) type LenUint = u32;
32
33 macro_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
43 macro_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
53 mod arrayvec_impl;
54 mod arrayvec;
55 mod array_string;
56 mod char;
57 mod errors;
58 mod utils;
59
60 pub use crate::array_string::ArrayString;
61 pub use crate::errors::CapacityError;
62
63 pub use crate::arrayvec::{ArrayVec, IntoIter, Drain};