Expand description
§StringTape
Memory-efficient string and bytes storage compatible with Apache Arrow.
§CharsTape - Sequential String Storage
use stringtape::{CharsTapeI32, StringTapeError};
let mut tape = CharsTapeI32::new();
tape.push("hello")?;
tape.push("world")?;
assert_eq!(tape.len(), 2);
assert_eq!(&tape[0], "hello");
assert!(tape.contains("hello"));
// Forward and reverse iteration
for s in &tape {
println!("{}", s);
}
for s in tape.iter().rev() {
println!("{}", s);
}§Standard Traits
All types implement standard traits for seamless integration:
use stringtape::{CharsTapeI32, StringTapeError};
use std::collections::HashMap;
let mut tape1 = CharsTapeI32::new();
tape1.push("a")?;
let tape2 = tape1.clone(); // Clone
assert_eq!(tape1, tape2); // PartialEq, Eq
assert!(tape1 <= tape2); // PartialOrd, Ord
let mut map = HashMap::new();
map.insert(tape1, 42); // Hash§CharsCows - Compressed Arbitrary-Order Slices
For extremely large datasets, use CharsCows with configurable offset/length types:
use stringtape::{CharsCowsU32U16, StringTapeError};
use std::borrow::Cow;
let data = "hello world foo bar";
// 6 bytes per entry (u32 offset + u16 length) vs 24+ bytes for Vec<String>
let cows = CharsCowsU32U16::from_iter_and_data(
data.split_whitespace(),
Cow::Borrowed(data.as_bytes())
)?;
assert_eq!(&cows[0], "hello");
assert_eq!(&cows[3], "bar");§BytesTape - Binary Data
use stringtape::{BytesTapeI32, StringTapeError};
let mut tape = BytesTapeI32::new();
tape.push(&[0xde, 0xad, 0xbe, 0xef])?;
tape.push(b"bytes")?;
assert_eq!(&tape[1], b"bytes" as &[u8]);Modules§
Structs§
- Bytes
Cows - A memory-efficient collection of byte slices with configurable offset and length types.
- Bytes
Cows Auto Iter - Iterator over BytesCowsAuto byte cows.
- Bytes
Cows Iter - Bytes
Tape - Binary bytes view over
RawTape. - Bytes
Tape Iter - Bytes
Tape View - Binary bytes view over
RawTapeView. - Bytes
Tape View Iter - Iterator over BytesTapeView byte slices.
- Chars
Cows - A memory-efficient collection of string slices with configurable offset and length types.
- Chars
Cows Auto Iter - Iterator over CharsCowsAuto string cows.
- Chars
Cows Iter - Chars
Tape - UTF-8 string view over
RawTape. - Chars
Tape Iter - Chars
Tape View - UTF-8 string view over
RawTapeView. - Chars
Tape View Iter - Iterator over CharsTapeView strings.
- RawParts
- Named raw parts returned by
as_raw_partsmethods. - RawTape
View - Zero-copy read-only view into a RawTape slice.
Enums§
- Bytes
Cows Auto - Automatically selects the most memory-efficient BytesCows type based on data size.
- Bytes
Tape Auto - Automatically selects the most memory-efficient BytesTape offset type.
- Chars
Cows Auto - Automatically selects the most memory-efficient CharsCows type based on data size.
- Chars
Tape Auto - Automatically selects the most memory-efficient CharsTape offset type.
- String
Tape Error - Errors that can occur when working with tape classes.
Traits§
- Length
Type - Trait for length types used in slice collections.
- Offset
Type - Trait for offset types used in CharsTape.
Type Aliases§
- Bytes
Cows U16U8 - Bytes
Cows U32U8 - Bytes
Cows U32U16 - Bytes
Cows U64U32 - Bytes
Tape I32 - Bytes
Tape I64 - Bytes
Tape U16 - Bytes
Tape U32 - Bytes
Tape U64 - Bytes
Tape View I32 - Bytes
Tape View I64 - Bytes
Tape View U16 - Bytes
Tape View U32 - Bytes
Tape View U64 - Chars
Cows U16U8 - Chars
Cows U32U8 - Chars
Cows U32U16 - Chars
Cows U64U32 - Chars
Tape I32 - Chars
Tape I64 - Chars
Tape U32 - Chars
Tape U64 - Chars
Tape View I32 - Chars
Tape View I64 - Chars
Tape View U32 - Chars
Tape View U64