Skip to content

Commit

Permalink
Improve explanation about IndexSet's complexity.
Browse files Browse the repository at this point in the history
  • Loading branch information
ynn committed Aug 16, 2023
1 parent 9469a1b commit 77c58aa
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ type Bucket<T> = super::Bucket<T, ()>;
/// `0..self.len()`. For example, the method `.get_full` looks up the index for
/// a value, and the method `.get_index` looks up the value by index.
///
/// # Complexity
///
/// Internally, `IndexSet<T, S>` just holds an [`IndexMap<T, (), S>`](IndexMap). Thus the complexity
/// of the two are the same for most methods.
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -420,6 +425,8 @@ where
}

/// Return item index, if it exists in the set
///
/// Computes in **O(1)** time (average).
pub fn get_index_of<Q: ?Sized>(&self, value: &Q) -> Option<usize>
where
Q: Hash + Equivalent<T>,
Expand Down

0 comments on commit 77c58aa

Please sign in to comment.