Skip to content

Commit da974f5

Browse files
committed
Make: Bump StringTape
1 parent b507a8f commit da974f5

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ rocm = ["std", "cpus"] # ROCm GPU backend (includes multi-threaded CPU backend)
3636

3737
[dependencies]
3838
allocator-api2 = { version = "0.3.0", optional = true }
39-
stringtape = { version = "1.1.0", optional = true }
39+
stringtape = { version = "2.0.3", optional = true }
4040

4141
[build-dependencies]
4242
cc = "1.2.35"

rust/stringzillas.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use core::ffi::{c_char, c_void, CStr};
44
use core::ptr;
55

66
use allocator_api2::{alloc::AllocError, alloc::Allocator, alloc::Layout};
7-
use stringtape::{BytesTape, BytesTapeView, StringTape, StringTapeView};
7+
use stringtape::{BytesTape, BytesTapeView, CharsTape, CharsTapeView};
88

99
// Re-export common types from stringzilla
1010
pub use crate::stringzilla::{SortedIdx, Status as SzStatus};
@@ -51,11 +51,11 @@ fn rust_error_from_c_message(status: Status, error_msg: *const c_char) -> Error
5151

5252
/// Tape variant that can hold either 32-bit or 64-bit string tapes with unsigned offsets
5353
pub enum AnyCharsTape<'a> {
54-
Tape32(StringTape<u32, UnifiedAlloc>),
55-
Tape64(StringTape<u64, UnifiedAlloc>),
54+
Tape32(CharsTape<u32, UnifiedAlloc>),
55+
Tape64(CharsTape<u64, UnifiedAlloc>),
5656
// Zero-copy FFI views (UTF-8)
57-
View32(StringTapeView<'a, u32>),
58-
View64(StringTapeView<'a, u64>),
57+
View32(CharsTapeView<'a, u32>),
58+
View64(CharsTapeView<'a, u64>),
5959
}
6060

6161
/// Tape variant that can hold either 32-bit or 64-bit byte tapes with unsigned offsets
@@ -370,8 +370,8 @@ impl From<&BytesTape<u32, UnifiedAlloc>> for SzSequenceU32Tape {
370370
}
371371
}
372372

373-
impl From<&StringTape<u32, UnifiedAlloc>> for SzSequenceU32Tape {
374-
fn from(tape: &StringTape<u32, UnifiedAlloc>) -> Self {
373+
impl From<&CharsTape<u32, UnifiedAlloc>> for SzSequenceU32Tape {
374+
fn from(tape: &CharsTape<u32, UnifiedAlloc>) -> Self {
375375
let parts = tape.as_raw_parts();
376376
SzSequenceU32Tape {
377377
data: parts.data_ptr,
@@ -392,8 +392,8 @@ impl From<&BytesTape<u64, UnifiedAlloc>> for SzSequenceU64Tape {
392392
}
393393
}
394394

395-
impl From<&StringTape<u64, UnifiedAlloc>> for SzSequenceU64Tape {
396-
fn from(tape: &StringTape<u64, UnifiedAlloc>) -> Self {
395+
impl From<&CharsTape<u64, UnifiedAlloc>> for SzSequenceU64Tape {
396+
fn from(tape: &CharsTape<u64, UnifiedAlloc>) -> Self {
397397
let parts = tape.as_raw_parts();
398398
SzSequenceU64Tape {
399399
data: parts.data_ptr,
@@ -448,8 +448,8 @@ impl<'a> From<&BytesTapeView<'a, u64>> for SzSequenceU64Tape {
448448
}
449449
}
450450

451-
impl<'a> From<StringTapeView<'a, u32>> for SzSequenceU32Tape {
452-
fn from(view: StringTapeView<'a, u32>) -> Self {
451+
impl<'a> From<CharsTapeView<'a, u32>> for SzSequenceU32Tape {
452+
fn from(view: CharsTapeView<'a, u32>) -> Self {
453453
let p = view.as_raw_parts();
454454
SzSequenceU32Tape {
455455
data: p.data_ptr,
@@ -459,8 +459,8 @@ impl<'a> From<StringTapeView<'a, u32>> for SzSequenceU32Tape {
459459
}
460460
}
461461

462-
impl<'a> From<StringTapeView<'a, u64>> for SzSequenceU64Tape {
463-
fn from(view: StringTapeView<'a, u64>) -> Self {
462+
impl<'a> From<CharsTapeView<'a, u64>> for SzSequenceU64Tape {
463+
fn from(view: CharsTapeView<'a, u64>) -> Self {
464464
let p = view.as_raw_parts();
465465
SzSequenceU64Tape {
466466
data: p.data_ptr,
@@ -470,8 +470,8 @@ impl<'a> From<StringTapeView<'a, u64>> for SzSequenceU64Tape {
470470
}
471471
}
472472

473-
impl<'a> From<&StringTapeView<'a, u32>> for SzSequenceU32Tape {
474-
fn from(view: &StringTapeView<'a, u32>) -> Self {
473+
impl<'a> From<&CharsTapeView<'a, u32>> for SzSequenceU32Tape {
474+
fn from(view: &CharsTapeView<'a, u32>) -> Self {
475475
let p = view.as_raw_parts();
476476
SzSequenceU32Tape {
477477
data: p.data_ptr,
@@ -481,8 +481,8 @@ impl<'a> From<&StringTapeView<'a, u32>> for SzSequenceU32Tape {
481481
}
482482
}
483483

484-
impl<'a> From<&StringTapeView<'a, u64>> for SzSequenceU64Tape {
485-
fn from(view: &StringTapeView<'a, u64>) -> Self {
484+
impl<'a> From<&CharsTapeView<'a, u64>> for SzSequenceU64Tape {
485+
fn from(view: &CharsTapeView<'a, u64>) -> Self {
486486
let p = view.as_raw_parts();
487487
SzSequenceU64Tape {
488488
data: p.data_ptr,
@@ -1306,7 +1306,7 @@ impl LevenshteinDistancesUtf8 {
13061306

13071307
/// Compute UTF-8 Levenshtein distances into an existing results buffer.
13081308
///
1309-
/// - Accepts `AnyCharsTape<'_>` for both sides: `StringTape` or `StringTapeView`.
1309+
/// - Accepts `AnyCharsTape<'_>` for both sides: `CharsTape` or `CharsTapeView`.
13101310
/// - Supports 32-bit or 64-bit offsets; both inputs must use the same width.
13111311
/// - No result allocations; writes into `results`.
13121312
///
@@ -2746,18 +2746,18 @@ where
27462746
}
27472747
}
27482748

2749-
/// Convert string sequences to StringTape
2749+
/// Convert string sequences to CharsTape
27502750
fn copy_chars_into_tape<'a, T: AsRef<str>>(sequences: &[T], force_64bit: bool) -> Result<AnyCharsTape<'a>, Error> {
27512751
// Estimate total size to decide between 32-bit and 64-bit tapes
27522752
let total_size: usize = sequences.iter().map(|s| s.as_ref().len()).sum();
27532753
let use_64bit = force_64bit || total_size > u32::MAX as usize || sequences.len() > u32::MAX as usize;
27542754

27552755
if use_64bit {
2756-
let mut tape = StringTape::<u64, UnifiedAlloc>::new_in(UnifiedAlloc);
2756+
let mut tape = CharsTape::<u64, UnifiedAlloc>::new_in(UnifiedAlloc);
27572757
tape.extend(sequences).map_err(|_| Error::from(SzStatus::BadAlloc))?;
27582758
Ok(AnyCharsTape::Tape64(tape))
27592759
} else {
2760-
let mut tape = StringTape::<u32, UnifiedAlloc>::new_in(UnifiedAlloc);
2760+
let mut tape = CharsTape::<u32, UnifiedAlloc>::new_in(UnifiedAlloc);
27612761
tape.extend(sequences).map_err(|_| Error::from(SzStatus::BadAlloc))?;
27622762
Ok(AnyCharsTape::Tape32(tape))
27632763
}

0 commit comments

Comments
 (0)