Crate stringtape

Crate stringtape 

Source
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");

// Iterate over strings
for s in &tape {
    println!("{}", s);
}

§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§

examples

Structs§

BytesCows
A memory-efficient collection of byte slices with configurable offset and length types.
BytesCowsIter
BytesTape
Binary bytes view over RawTape.
BytesTapeIter
BytesTapeView
Binary bytes view over RawTapeView.
CharsCows
A memory-efficient collection of string slices with configurable offset and length types.
CharsCowsAutoIter
Iterator over CharsCowsAuto string cows.
CharsCowsIter
CharsTape
UTF-8 string view over RawTape.
CharsTapeIter
CharsTapeView
UTF-8 string view over RawTapeView.
RawParts
Named raw parts returned by as_raw_parts methods.
RawTapeView
Zero-copy read-only view into a RawTape slice.

Enums§

BytesCowsAuto
Automatically selects the most memory-efficient BytesCows type based on data size.
BytesTapeAuto
Automatically selects the most memory-efficient BytesTape offset type.
CharsCowsAuto
Automatically selects the most memory-efficient CharsCows type based on data size.
CharsTapeAuto
Automatically selects the most memory-efficient CharsTape offset type.
StringTapeError
Errors that can occur when working with tape classes.

Traits§

LengthType
Trait for length types used in slice collections.
OffsetType
Trait for offset types used in CharsTape.

Type Aliases§

BytesCowsU16U8
BytesCowsU32U8
BytesCowsU32U16
BytesCowsU64U32
BytesTapeI32
BytesTapeI64
BytesTapeU16
BytesTapeU32
BytesTapeU64
BytesTapeViewI32
BytesTapeViewI64
BytesTapeViewU16
BytesTapeViewU32
BytesTapeViewU64
CharsCowsU16U8
CharsCowsU32U8
CharsCowsU32U16
CharsCowsU64U32
CharsTapeI32
CharsTapeI64
CharsTapeU32
CharsTapeU64
CharsTapeViewI32
CharsTapeViewI64
CharsTapeViewU32
CharsTapeViewU64