pub mod hasher;
pub mod cap_inspect;
#[cfg(feature = "telemetry")]
pub mod reservoir;
#[cfg(feature = "telemetry")]
pub mod registry;
pub mod dump;
#[cfg(feature = "telemetry")]
mod autodump;
pub mod stats;
#[cfg(feature = "telemetry")]
mod tracked;
#[cfg(not(feature = "telemetry"))]
pub mod aliases;
#[doc(hidden)]
pub mod ctor;
pub use cap_inspect::CapInspect;
pub use captrack_macros::declare_collections;
pub use dump::dump_capacity_stats;
pub use hasher::CapHasher;
pub use stats::SampleStats;
#[cfg(feature = "telemetry")]
pub use tracked::{
TrackedBTreeMap, TrackedBTreeSet, TrackedBinaryHeap, TrackedBytesMut, TrackedDashMap,
TrackedHashMap, TrackedHashSet, TrackedHashbrownMap, TrackedIndexMap, TrackedIndexSet,
TrackedSccHashMap, TrackedSccHashSet, TrackedSccTreeIndex, TrackedSmallVec, TrackedString,
TrackedVec, TrackedVecDeque,
};
#[cfg(not(feature = "telemetry"))]
pub use aliases::*;
pub trait IntoInner: Sized {
type Inner;
fn into_inner(self) -> Self::Inner;
}
impl IntoInner for std::string::String {
type Inner = std::string::String;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
impl<T: std::cmp::Ord> IntoInner for std::collections::BinaryHeap<T> {
type Inner = std::collections::BinaryHeap<T>;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
impl<T> IntoInner for std::vec::Vec<T> {
type Inner = std::vec::Vec<T>;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
impl<T> IntoInner for std::collections::VecDeque<T> {
type Inner = std::collections::VecDeque<T>;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
impl<K: std::cmp::Ord, V> IntoInner for std::collections::BTreeMap<K, V> {
type Inner = std::collections::BTreeMap<K, V>;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
impl<T: std::cmp::Ord> IntoInner for std::collections::BTreeSet<T> {
type Inner = std::collections::BTreeSet<T>;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
impl<K, V, S> IntoInner for std::collections::HashMap<K, V, S> {
type Inner = std::collections::HashMap<K, V, S>;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
impl<T, S> IntoInner for std::collections::HashSet<T, S> {
type Inner = std::collections::HashSet<T, S>;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
#[cfg(any(feature = "bytes", feature = "telemetry"))]
impl IntoInner for ::bytes::BytesMut {
type Inner = ::bytes::BytesMut;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
#[cfg(any(feature = "indexmap", feature = "telemetry"))]
impl<K, V, S> IntoInner for ::indexmap::IndexMap<K, V, S> {
type Inner = ::indexmap::IndexMap<K, V, S>;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
#[cfg(any(feature = "indexmap", feature = "telemetry"))]
impl<T, S> IntoInner for ::indexmap::IndexSet<T, S> {
type Inner = ::indexmap::IndexSet<T, S>;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
#[cfg(any(feature = "dashmap", feature = "telemetry"))]
impl<K, V, S> IntoInner for ::dashmap::DashMap<K, V, S>
where
K: Eq + std::hash::Hash,
S: std::hash::BuildHasher + Clone,
{
type Inner = ::dashmap::DashMap<K, V, S>;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
#[cfg(any(feature = "scc", feature = "telemetry"))]
impl<K, V, S> IntoInner for ::scc::HashMap<K, V, S>
where
K: Eq + std::hash::Hash + 'static,
V: 'static,
S: std::hash::BuildHasher,
{
type Inner = ::scc::HashMap<K, V, S>;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
#[cfg(any(feature = "scc", feature = "telemetry"))]
impl<T, S> IntoInner for ::scc::HashSet<T, S>
where
T: Eq + std::hash::Hash + 'static,
S: std::hash::BuildHasher,
{
type Inner = ::scc::HashSet<T, S>;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
#[cfg(any(feature = "scc", feature = "telemetry"))]
impl<K, V> IntoInner for ::scc::TreeIndex<K, V>
where
K: Clone + Ord + 'static,
V: Clone + 'static,
{
type Inner = ::scc::TreeIndex<K, V>;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
#[cfg(any(feature = "smallvec", feature = "telemetry"))]
impl<A: ::smallvec::Array> IntoInner for ::smallvec::SmallVec<A> {
type Inner = ::smallvec::SmallVec<A>;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
#[cfg(any(feature = "hashbrown", feature = "telemetry"))]
impl<K, V, S> IntoInner for ::hashbrown::HashMap<K, V, S> {
type Inner = ::hashbrown::HashMap<K, V, S>;
#[inline(always)]
fn into_inner(self) -> Self::Inner {
self
}
}
#[macro_export]
macro_rules! tvec {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::ctor::vec_with_capacity_named::<_>($cap, $name, file!(), line!(), column!())
}};
}
#[macro_export]
macro_rules! tvec_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::ctor::vec_owned_with_capacity_named::<_>($cap, $name, file!(), line!(), column!())
}};
}
#[macro_export]
macro_rules! tvecdeque {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::ctor::vecdeque_with_capacity_named::<_>($cap, $name, file!(), line!(), column!())
}};
}
#[macro_export]
macro_rules! tvecdeque_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::ctor::vecdeque_owned_with_capacity_named::<_>(
$cap,
$name,
file!(),
line!(),
column!(),
)
}};
}
#[macro_export]
macro_rules! tbtreemap {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::ctor::btreemap_new_named::<_, _>($cap, $name, file!(), line!(), column!())
}};
}
#[macro_export]
macro_rules! tbtreeset {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::ctor::btreeset_new_named::<_>($cap, $name, file!(), line!(), column!())
}};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tbytesmut {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::bytes::BytesMut::with_capacity($cap)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tbytesmut {
($name:literal, $cap:expr) => {
$crate::TrackedBytesMut::with_capacity_named($cap, $name, file!(), line!(), column!())
};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tbytesmut_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::bytes::BytesMut::with_capacity($cap)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tbytesmut_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::registry::record_initial($name, file!(), line!(), column!(), $cap);
#[allow(clippy::disallowed_methods)]
::bytes::BytesMut::with_capacity($cap)
}};
}
#[macro_export]
macro_rules! tfxmap {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::ctor::hashmap_with_capacity_named::<_, _, $crate::CapHasher>(
$cap,
$name,
file!(),
line!(),
column!(),
)
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
$crate::ctor::hashmap_with_capacity_and_hasher_named(
$cap,
$hasher,
$name,
file!(),
line!(),
column!(),
)
}};
}
#[macro_export]
macro_rules! tfxmap_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::ctor::hashmap_owned_with_capacity_named::<_, _, $crate::CapHasher>(
$cap,
$name,
file!(),
line!(),
column!(),
)
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
$crate::ctor::hashmap_owned_with_capacity_and_hasher_named(
$cap,
$hasher,
$name,
file!(),
line!(),
column!(),
)
}};
}
#[macro_export]
macro_rules! tfxset {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::ctor::hashset_with_capacity_named::<_, $crate::CapHasher>(
$cap,
$name,
file!(),
line!(),
column!(),
)
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
$crate::ctor::hashset_with_capacity_and_hasher_named(
$cap,
$hasher,
$name,
file!(),
line!(),
column!(),
)
}};
}
#[macro_export]
macro_rules! tfxset_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::ctor::hashset_owned_with_capacity_named::<_, $crate::CapHasher>(
$cap,
$name,
file!(),
line!(),
column!(),
)
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
$crate::ctor::hashset_owned_with_capacity_and_hasher_named(
$cap,
$hasher,
$name,
file!(),
line!(),
column!(),
)
}};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tmap {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::indexmap::IndexMap::with_capacity_and_hasher(
$cap,
<$crate::CapHasher as ::core::default::Default>::default(),
)
}
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::indexmap::IndexMap::with_capacity_and_hasher($cap, $hasher)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tmap {
($name:literal, $cap:expr) => {
$crate::TrackedIndexMap::<_, _, $crate::CapHasher>::with_capacity_named(
$cap,
$name,
file!(),
line!(),
column!(),
)
};
($name:literal, $cap:expr; $hasher:expr) => {
$crate::TrackedIndexMap::with_capacity_and_hasher_named(
$cap,
$hasher,
$name,
file!(),
line!(),
column!(),
)
};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tmap_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::indexmap::IndexMap::with_capacity_and_hasher(
$cap,
<$crate::CapHasher as ::core::default::Default>::default(),
)
}
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::indexmap::IndexMap::with_capacity_and_hasher($cap, $hasher)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tmap_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::registry::record_initial($name, file!(), line!(), column!(), $cap);
#[allow(clippy::disallowed_methods)]
::indexmap::IndexMap::with_capacity_and_hasher(
$cap,
<$crate::CapHasher as ::core::default::Default>::default(),
)
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
$crate::registry::record_initial($name, file!(), line!(), column!(), $cap);
#[allow(clippy::disallowed_methods)]
::indexmap::IndexMap::with_capacity_and_hasher($cap, $hasher)
}};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tset {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::indexmap::IndexSet::with_capacity_and_hasher(
$cap,
<$crate::CapHasher as ::core::default::Default>::default(),
)
}
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::indexmap::IndexSet::with_capacity_and_hasher($cap, $hasher)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tset {
($name:literal, $cap:expr) => {
$crate::TrackedIndexSet::<_, $crate::CapHasher>::with_capacity_named(
$cap,
$name,
file!(),
line!(),
column!(),
)
};
($name:literal, $cap:expr; $hasher:expr) => {
$crate::TrackedIndexSet::with_capacity_and_hasher_named(
$cap,
$hasher,
$name,
file!(),
line!(),
column!(),
)
};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tset_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::indexmap::IndexSet::with_capacity_and_hasher(
$cap,
<$crate::CapHasher as ::core::default::Default>::default(),
)
}
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::indexmap::IndexSet::with_capacity_and_hasher($cap, $hasher)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tset_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::registry::record_initial($name, file!(), line!(), column!(), $cap);
#[allow(clippy::disallowed_methods)]
::indexmap::IndexSet::with_capacity_and_hasher(
$cap,
<$crate::CapHasher as ::core::default::Default>::default(),
)
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
$crate::registry::record_initial($name, file!(), line!(), column!(), $cap);
#[allow(clippy::disallowed_methods)]
::indexmap::IndexSet::with_capacity_and_hasher($cap, $hasher)
}};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tdashmap {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::dashmap::DashMap::with_capacity_and_hasher(
$cap,
<$crate::CapHasher as ::core::default::Default>::default(),
)
}
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::dashmap::DashMap::with_capacity_and_hasher($cap, $hasher)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tdashmap {
($name:literal, $cap:expr) => {
$crate::TrackedDashMap::<_, _, $crate::CapHasher>::with_capacity_named(
$cap,
$name,
file!(),
line!(),
column!(),
)
};
($name:literal, $cap:expr; $hasher:expr) => {
$crate::TrackedDashMap::with_capacity_and_hasher_named(
$cap,
$hasher,
$name,
file!(),
line!(),
column!(),
)
};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tdashmap_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::dashmap::DashMap::with_capacity_and_hasher(
$cap,
<$crate::CapHasher as ::core::default::Default>::default(),
)
}
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::dashmap::DashMap::with_capacity_and_hasher($cap, $hasher)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tdashmap_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::registry::record_initial($name, file!(), line!(), column!(), $cap);
#[allow(clippy::disallowed_methods)]
::dashmap::DashMap::with_capacity_and_hasher(
$cap,
<$crate::CapHasher as ::core::default::Default>::default(),
)
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
$crate::registry::record_initial($name, file!(), line!(), column!(), $cap);
#[allow(clippy::disallowed_methods)]
::dashmap::DashMap::with_capacity_and_hasher($cap, $hasher)
}};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tsccmap {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::scc::HashMap::with_capacity_and_hasher(
$cap,
<$crate::CapHasher as ::core::default::Default>::default(),
)
}
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::scc::HashMap::with_capacity_and_hasher($cap, $hasher)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tsccmap {
($name:literal, $cap:expr) => {
$crate::TrackedSccHashMap::<_, _, $crate::CapHasher>::with_capacity_named(
$cap,
$name,
file!(),
line!(),
column!(),
)
};
($name:literal, $cap:expr; $hasher:expr) => {
$crate::TrackedSccHashMap::with_capacity_and_hasher_named(
$cap,
$hasher,
$name,
file!(),
line!(),
column!(),
)
};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tsccmap_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::scc::HashMap::with_capacity_and_hasher(
$cap,
<$crate::CapHasher as ::core::default::Default>::default(),
)
}
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::scc::HashMap::with_capacity_and_hasher($cap, $hasher)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tsccmap_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::registry::record_initial($name, file!(), line!(), column!(), $cap);
#[allow(clippy::disallowed_methods)]
::scc::HashMap::with_capacity_and_hasher(
$cap,
<$crate::CapHasher as ::core::default::Default>::default(),
)
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
$crate::registry::record_initial($name, file!(), line!(), column!(), $cap);
#[allow(clippy::disallowed_methods)]
::scc::HashMap::with_capacity_and_hasher($cap, $hasher)
}};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tsccset {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::scc::HashSet::with_capacity_and_hasher(
$cap,
<$crate::CapHasher as ::core::default::Default>::default(),
)
}
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::scc::HashSet::with_capacity_and_hasher($cap, $hasher)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tsccset {
($name:literal, $cap:expr) => {
$crate::TrackedSccHashSet::<_, $crate::CapHasher>::with_capacity_named(
$cap,
$name,
file!(),
line!(),
column!(),
)
};
($name:literal, $cap:expr; $hasher:expr) => {
$crate::TrackedSccHashSet::with_capacity_and_hasher_named(
$cap,
$hasher,
$name,
file!(),
line!(),
column!(),
)
};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tsccset_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::scc::HashSet::with_capacity_and_hasher(
$cap,
<$crate::CapHasher as ::core::default::Default>::default(),
)
}
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::scc::HashSet::with_capacity_and_hasher($cap, $hasher)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tsccset_owned {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
$crate::registry::record_initial($name, file!(), line!(), column!(), $cap);
#[allow(clippy::disallowed_methods)]
::scc::HashSet::with_capacity_and_hasher(
$cap,
<$crate::CapHasher as ::core::default::Default>::default(),
)
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
$crate::registry::record_initial($name, file!(), line!(), column!(), $cap);
#[allow(clippy::disallowed_methods)]
::scc::HashSet::with_capacity_and_hasher($cap, $hasher)
}};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tscctree {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
let _ = $cap;
{
#[allow(clippy::disallowed_methods)]
::scc::TreeIndex::new()
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tscctree {
($name:literal, $cap:expr) => {
$crate::TrackedSccTreeIndex::new_named($cap, $name, file!(), line!(), column!())
};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tsmallvec {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::smallvec::SmallVec::<_>::with_capacity($cap)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tsmallvec {
($name:literal, $cap:expr) => {
$crate::TrackedSmallVec::<_>::with_capacity_named($cap, $name, file!(), line!(), column!())
};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tstring {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::std::string::String::with_capacity($cap)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tstring {
($name:literal, $cap:expr) => {
$crate::TrackedString::with_capacity_named($cap, $name, file!(), line!(), column!())
};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! thashbrownmap {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::hashbrown::HashMap::with_capacity($cap)
}
}};
($name:literal, $cap:expr; $hasher:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::hashbrown::HashMap::with_capacity_and_hasher($cap, $hasher)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! thashbrownmap {
($name:literal, $cap:expr) => {
$crate::TrackedHashbrownMap::<_, _>::with_capacity_named(
$cap,
$name,
file!(),
line!(),
column!(),
)
};
($name:literal, $cap:expr; $hasher:expr) => {
$crate::TrackedHashbrownMap::with_capacity_and_hasher_named(
$cap,
$hasher,
$name,
file!(),
line!(),
column!(),
)
};
}
#[cfg(not(feature = "telemetry"))]
#[macro_export]
macro_rules! tbinaryheap {
($name:literal, $cap:expr) => {{
let _: &'static str = $name;
{
#[allow(clippy::disallowed_methods)]
::std::collections::BinaryHeap::with_capacity($cap)
}
}};
}
#[cfg(feature = "telemetry")]
#[macro_export]
macro_rules! tbinaryheap {
($name:literal, $cap:expr) => {
$crate::TrackedBinaryHeap::<_>::with_capacity_named(
$cap,
$name,
file!(),
line!(),
column!(),
)
};
}
#[cfg(test)]
mod tests;