Skip to content

Commit

Permalink
doc: add rustdoc for funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakobzs committed Jul 1, 2024
1 parent 8e8fdd6 commit 7bc588c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ pub struct PatternScanner {
}

impl PatternScanner {
/// Scan for a unique pattern in the stored bytes
pub fn scan<T: AsRef<str>>(&self, pattern: T) -> Result<Option<usize>, PatternScannerError> {
self.scan_with_bytes(&self.bytes, pattern)
}

/// Scan for a unique pattern in the specified bytes
pub fn scan_with_bytes<T: AsRef<[u8]> + std::marker::Sync, U: AsRef<str>>(
&self,
bytes: T,
Expand All @@ -35,10 +37,12 @@ impl PatternScanner {
Ok(results.first().copied())
}

/// Scan for all occurrences of a pattern in the stored bytes
pub fn scan_all<T: AsRef<str>>(&self, pattern: T) -> Result<Vec<usize>, PatternScannerError> {
self.scan_all_with_bytes(&self.bytes, pattern)
}

/// Scan for all occurrences of a pattern in the specified bytes
pub fn scan_all_with_bytes<T: AsRef<[u8]> + std::marker::Sync, U: AsRef<str>>(
&self,
bytes: T,
Expand Down

0 comments on commit 7bc588c

Please sign in to comment.