Skip to content

Commit

Permalink
fzf: add docs to constructor methods
Browse files Browse the repository at this point in the history
  • Loading branch information
noib3 committed Nov 27, 2023
1 parent eec842a commit 579fba2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
8 changes: 6 additions & 2 deletions src/algos/fzf/fzf_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,17 @@ impl core::fmt::Debug for FzfV1 {
}

impl FzfV1 {
/// TODO: docs
/// Creates a new `FzfV1`.
///
/// This will immediately allocate 512 bytes of heap memory, so it's
/// recommended to call this once and reuse the same instance for multiple
/// distance calculations.
#[inline(always)]
pub fn new() -> Self {
Self::default()
}

/// TODO: docs
/// Returns the current scoring scheme. This is only used for testing.
#[cfg(feature = "tests")]
pub fn scheme(&self) -> &Scheme {
&self.scoring_scheme
Expand Down
8 changes: 6 additions & 2 deletions src/algos/fzf/fzf_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,17 @@ impl core::fmt::Debug for FzfV2 {
}

impl FzfV2 {
/// TODO: docs
/// Creates a new `FzfV2`.
///
/// This will immediately allocate around 5kb of heap memory, so it's
/// recommended to call this once and reuse the same instance for multiple
/// distance calculations.
#[inline(always)]
pub fn new() -> Self {
Self::default()
}

/// TODO: docs
/// Returns the current scoring scheme. This is only used for testing.
#[cfg(feature = "tests")]
pub fn scheme(&self) -> &Scheme {
&self.scoring_scheme
Expand Down
12 changes: 6 additions & 6 deletions src/algos/fzf/slab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use core::ops::{Index, IndexMut};

use super::Score;

/// TODO: docs
/// Creating a new [`V2Slab`] allocates 5.25kb on a 64-bit system and 4.25kb on
/// a 32-bit system.
#[derive(Clone, Default)]
pub(super) struct V2Slab {
/// TODO: docs
Expand All @@ -18,7 +19,6 @@ pub(super) struct V2Slab {
pub(super) scoring_matrix: MatrixSlab<Score>,
}

// #[repr(align(8))]
/// TODO: docs
#[derive(Clone, Default)]
pub(super) struct Bonus {
Expand All @@ -44,7 +44,7 @@ impl Bonus {
}
}

/// TODO: docs
/// Creating a new [`BonusSlab`] allocates 256 bytes.
#[derive(Clone)]
pub(super) struct BonusSlab {
vec: Vec<Bonus>,
Expand Down Expand Up @@ -75,7 +75,7 @@ impl BonusSlab {
}
}

/// TODO: docs
/// Creating a new [`CandidateSlab`] allocates 512 bytes.
#[derive(Clone)]
pub(super) struct CandidateSlab {
chars: Vec<char>,
Expand Down Expand Up @@ -106,7 +106,7 @@ impl CandidateSlab {
}
}

/// TODO: docs
/// Creating a new [`MatchedIndicesSlab`] allocates 1kb on a 64-bit system.
#[derive(Clone)]
pub(super) struct MatchedIndicesSlab {
vec: Vec<usize>,
Expand Down Expand Up @@ -169,7 +169,7 @@ impl MatrixItem for usize {
}
}

/// TODO: docs
/// Creating a new [`MatrixSlab`] allocates `256 * size_of::<T>()` bytes.
#[derive(Clone)]
pub(super) struct MatrixSlab<T: MatrixItem> {
vec: Vec<T>,
Expand Down

0 comments on commit 579fba2

Please sign in to comment.