Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix minor documentation typos #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions matcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,13 @@ impl Matcher {
self.fuzzy_matcher_impl::<false>(haystack, needle, &mut Vec::new())
}

/// Find the fuzzy match with the higehest score in the `haystack` and
/// Find the fuzzy match with the highest score in the `haystack` and
/// compute its indices.
///
/// This functions has `O(mn)` time complexity for short inputs. To
/// avoid slowdowns it automatically falls back to [greedy matching]
/// (crate::Matcher::fuzzy_match_greedy) for large needles and haystacks
/// avoid slowdowns it automatically falls back to
/// [greedy matching](crate::Matcher::fuzzy_match_greedy) for large needles
/// and haystacks
///
/// See the [matcher documentation](crate::Matcher) for more details.
pub fn fuzzy_indices(
Expand Down
12 changes: 6 additions & 6 deletions matcher/src/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,8 @@ pub struct Pattern {

impl Pattern {
/// Creates a pattern where each word is matched individually (whitespaces
/// can be escaped with `\`). Otherwise no parsing is performed (so $, !, '
/// and ^ don't receive special treatment). If you want to match the entire
/// can be escaped with `\`). Otherwise no parsing is performed (so `$`, `!`,
/// `'` and `^` don't receive special treatment). If you want to match the entire
/// pattern as a single needle use a single [`Atom`] instead.
pub fn new(
pattern: &str,
Expand All @@ -437,7 +437,7 @@ impl Pattern {
Pattern { atoms }
}
/// Creates a pattern where each word is matched individually (whitespaces
/// can be escaped with `\`). And $, !, ' and ^ at word boundaries will
/// can be escaped with `\`). And `$`, `!`, `'` and `^` at word boundaries will
/// cause different matching behaviour (see [`AtomKind`]). These can be
/// escaped with backslash.
pub fn parse(pattern: &str, case_matching: CaseMatching, normalize: Normalization) -> Pattern {
Expand Down Expand Up @@ -479,8 +479,8 @@ impl Pattern {
}

/// Matches this pattern against `haystack` (using the allocation and configuration
/// from `matcher`) and calculates a ranking score. See the [`Matcher`].
/// Documentation for more details.
/// from `matcher`) and calculates a ranking score. See the [`Matcher`]
/// documentation for more details.
///
/// *Note:* The `ignore_case` setting is overwritten to match the casing of
/// each pattern atom.
Expand All @@ -497,7 +497,7 @@ impl Pattern {

/// Matches this pattern against `haystack` (using the allocation and
/// configuration from `matcher`), calculates a ranking score and the match
/// indices. See the [`Matcher`]. Documentation for more
/// indices. See the [`Matcher`] documentation for more
/// details.
///
/// *Note:* The `ignore_case` setting is overwritten to match the casing of
Expand Down
21 changes: 11 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl<T> Injector<T> {
/// # Safety
///
/// Item at `index` must be initialized. That means you must have observed
/// `push` returning this value or `get` retunring `Some` for this value.
/// `push` returning this value or `get` returning `Some` for this value.
/// Just because a later index is initialized doesn't mean that this index
/// is initialized
pub unsafe fn get_unchecked(&self, index: u32) -> Item<'_, T> {
Expand Down Expand Up @@ -160,7 +160,7 @@ impl<T: Sync + Send + 'static> Snapshot<T> {
self.matches.len() as u32
}

/// Returns an iteror over the items that correspond to a subrange of
/// Returns an iterator over the items that correspond to a subrange of
/// all the matches in this snapshot.
///
/// # Panics
Expand Down Expand Up @@ -203,19 +203,19 @@ impl<T: Sync + Send + 'static> Snapshot<T> {
///
/// Returns `None` if the given `index` is not initialized. This function
/// is only guarteed to return `Some` for item indices that can be found in
/// the `matches` of this struct. Both small and larger indices may returns
/// `None`
/// the `matches` of this struct. Both small and larger indices may return
/// `None`.
#[inline]
pub fn get_item(&self, index: u32) -> Option<Item<'_, T>> {
self.items.get(index)
}

/// Returns a reference to the nth match.
/// Returns a reference to the `n`th match.
///
/// Returns `None` if the given `index` is not initialized. This function
/// is only guarteed to return `Some` for item indices that can be found in
/// the `matches` of this struct. Both small and larger indices may returns
/// `None`
/// the `matches` of this struct. Both small and larger indices may return
/// `None`.
#[inline]
pub fn get_matched_item(&self, n: u32) -> Option<Item<'_, T>> {
self.get_item(self.matches.get(n as usize)?.idx)
Expand Down Expand Up @@ -282,7 +282,7 @@ impl<T: Sync + Send + 'static> Nucleo<T> {
///
/// Nucleo can match items with multiple orthogonal properties. `columns`
/// indicates how many matching columns each item (and the pattern) has. The
/// number of columns can not be changed after construction.
/// number of columns cannot be changed after construction.
pub fn new(
config: Config,
notify: Arc<(dyn Fn() + Sync + Send)>,
Expand Down Expand Up @@ -331,8 +331,8 @@ impl<T: Sync + Send + 'static> Nucleo<T> {
/// Restart the the item stream. Removes all items and disconnects all
/// previously created injectors from this instance. If `clear_snapshot`
/// is `true` then all items and matched are removed from the [`Snapshot`]
/// (crate::Snapshot) immediately. Otherwise the snapshot will keep the
/// current matches until the matcher has run again.
/// immediately. Otherwise the snapshot will keep the current matches until
/// the matcher has run again.
///
/// # Note
///
Expand All @@ -348,6 +348,7 @@ impl<T: Sync + Send + 'static> Nucleo<T> {
}
}

/// Update the internal configuration.
pub fn update_config(&mut self, config: Config) {
self.worker.lock().update_config(config)
}
Expand Down