Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
abbiecnt committed Sep 13, 2024
1 parent 6ad3a6d commit 741f47f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ impl Base {
}

#[inline]
/// # Safety
///
///
pub const unsafe fn add(&self, count: usize) -> NonNull<u8> {
// SAFETY: todo!()
unsafe { self.ptr.add(count) }
}

Expand Down
4 changes: 2 additions & 2 deletions src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl Program {
/// assert_eq!(data.as_ptr(), ptr.as_ptr());
/// ```
pub fn find(&self, pattern: &[u8]) -> Option<NonNull<u8>> {
assert!(pattern.len() >= 1);
assert!(!pattern.is_empty());

self.as_slice()
.par_windows(pattern.len())
Expand Down Expand Up @@ -134,7 +134,7 @@ impl Program {
/// assert_eq!(data.as_ptr(), ptr.as_ptr());
/// ```
pub fn rfind(&self, pattern: &[u8]) -> Option<NonNull<u8>> {
assert!(pattern.len() >= 1);
assert!(!pattern.is_empty());

self.as_slice()
.par_windows(pattern.len())
Expand Down
6 changes: 3 additions & 3 deletions src/section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ impl Section {
}

pub fn contains(&self, pattern: &[u8]) -> bool {
assert!(pattern.len() >= 1);
assert!(!pattern.is_empty());

self.find(pattern).is_some()
}

pub fn find(&self, pattern: &[u8]) -> Option<NonNull<u8>> {
assert!(pattern.len() >= 1);
assert!(!pattern.is_empty());

self.as_slice()
.par_windows(pattern.len())
Expand All @@ -53,7 +53,7 @@ impl Section {
}

pub fn rfind(&self, pattern: &[u8]) -> Option<NonNull<u8>> {
assert!(pattern.len() >= 1);
assert!(!pattern.is_empty());

self.as_slice()
.par_windows(pattern.len())
Expand Down

0 comments on commit 741f47f

Please sign in to comment.