Skip to content

Commit

Permalink
Merge pull request #273 from your-diary/docs/indexset
Browse files Browse the repository at this point in the history
Improve explanation about `IndexSet`'s complexity.
  • Loading branch information
cuviper authored Aug 16, 2023
2 parents 9469a1b + 77c58aa commit 0604c5b
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 0604c5b

Please sign in to comment.