From 08cb01e6ef9f6bfe0251c167acb89d7051c5da59 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 28 Feb 2023 19:42:31 +0000 Subject: [PATCH] Mark `IndexedMap` types as `(C-not exported)` While we could try to expose the type explicitly, we already have alternative accessors for bindings, and mapping `Hash`, `Ord` and the other requirements for `IndexedMap` would be a good chunk of additional work. --- lightning/src/util/indexed_map.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lightning/src/util/indexed_map.rs b/lightning/src/util/indexed_map.rs index 3d4517251..2b5bbac0d 100644 --- a/lightning/src/util/indexed_map.rs +++ b/lightning/src/util/indexed_map.rs @@ -21,6 +21,8 @@ use core::ops::{Bound, RangeBounds}; /// actually backed by a [`HashMap`], with some additional tracking to ensure we can iterate over /// keys in the order defined by [`Ord`]. /// +/// (C-not exported) as bindings provide alternate accessors rather than exposing maps directly. +/// /// [`BTreeMap`]: alloc::collections::BTreeMap #[derive(Clone, Debug, Eq)] pub struct IndexedMap { @@ -147,6 +149,8 @@ impl PartialEq for IndexedMap { } /// An iterator over a range of values in an [`IndexedMap`] +/// +/// (C-not exported) as bindings provide alternate accessors rather than exposing maps directly. pub struct Range<'a, K: Hash + Ord, V> { inner_range: Iter<'a, K>, map: &'a HashMap, @@ -161,6 +165,8 @@ impl<'a, K: Hash + Ord, V: 'a> Iterator for Range<'a, K, V> { } /// An [`Entry`] for a key which currently has no value +/// +/// (C-not exported) as bindings provide alternate accessors rather than exposing maps directly. pub struct VacantEntry<'a, K: Hash + Ord, V> { #[cfg(feature = "hashbrown")] underlying_entry: hash_map::VacantEntry<'a, K, V, hash_map::DefaultHashBuilder>, @@ -171,6 +177,8 @@ pub struct VacantEntry<'a, K: Hash + Ord, V> { } /// An [`Entry`] for an existing key-value pair +/// +/// (C-not exported) as bindings provide alternate accessors rather than exposing maps directly. pub struct OccupiedEntry<'a, K: Hash + Ord, V> { #[cfg(feature = "hashbrown")] underlying_entry: hash_map::OccupiedEntry<'a, K, V, hash_map::DefaultHashBuilder>, @@ -181,6 +189,8 @@ pub struct OccupiedEntry<'a, K: Hash + Ord, V> { /// A mutable reference to a position in the map. This can be used to reference, add, or update the /// value at a fixed key. +/// +/// (C-not exported) as bindings provide alternate accessors rather than exposing maps directly. pub enum Entry<'a, K: Hash + Ord, V> { /// A mutable reference to a position within the map where there is no value. Vacant(VacantEntry<'a, K, V>), -- 2.39.5