Skip to content

Commit

Permalink
Add note about const trait
Browse files Browse the repository at this point in the history
  • Loading branch information
sffc committed May 7, 2023
1 parent 2025c08 commit 4aff0cf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions utils/litemap/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,8 @@ where
impl<'a, K, V> LiteMap<K, V, &'a [(K, V)]> {
/// Const version of [`LiteMap::len()`] for a slice store.
///
/// Note: This function will no longer be needed if const trait behavior is stabilized.
///
/// # Examples
///
/// ```rust
Expand All @@ -593,6 +595,8 @@ impl<'a, K, V> LiteMap<K, V, &'a [(K, V)]> {

/// Const version of [`LiteMap::is_empty()`] for a slice store.
///
/// Note: This function will no longer be needed if const trait behavior is stabilized.
///
/// # Examples
///
/// ```rust
Expand All @@ -609,6 +613,8 @@ impl<'a, K, V> LiteMap<K, V, &'a [(K, V)]> {

/// Const version of [`LiteMap::get_indexed()`] for a slice store.
///
/// Note: This function will no longer be needed if const trait behavior is stabilized.
///
/// # Panics
///
/// Panics if the index is out of bounds.
Expand Down Expand Up @@ -661,6 +667,8 @@ impl<'a, V> LiteMap<&'a str, V, &'a [(&'a str, V)]> {
///
/// Also returns the index of the value.
///
/// Note: This function will no longer be needed if const trait behavior is stabilized.
///
/// # Examples
///
/// ```rust
Expand Down Expand Up @@ -702,6 +710,8 @@ impl<'a, V> LiteMap<&'a [u8], V, &'a [(&'a [u8], V)]> {
///
/// Also returns the index of the value.
///
/// Note: This function will no longer be needed if const trait behavior is stabilized.
///
/// # Examples
///
/// ```rust
Expand Down Expand Up @@ -743,6 +753,8 @@ macro_rules! impl_const_get_with_index_for_integer {
impl<'a, V> LiteMap<$integer, V, &'a [($integer, V)]> {
/// Const function to get the value associated with an integer key, if it exists.
///
/// Note: This function will no longer be needed if const trait behavior is stabilized.
///
/// Also returns the index of the value.
pub const fn const_get_with_index(&self, key: $integer) -> Option<(usize, &'a V)> {
let mut i = 0;
Expand Down

0 comments on commit 4aff0cf

Please sign in to comment.