pub struct FixedChunker { /* private fields */ }Expand description
Fixed-size chunker with configurable overlap.
§Example
use slabs::{Chunker, FixedChunker};
let chunker = FixedChunker::new(100, 20);
let text = "A".repeat(250);
let slabs = chunker.chunk(&text);
// 250 bytes with step=80: starts at 0, 80, 160 = 3 chunks
// (240 would start a 4th but 240+100 > 250, and remainder < step)
assert!(slabs.len() >= 3);
assert_eq!(slabs[0].len(), 100);
assert_eq!(slabs[1].start, 80); // 100 - 20 overlapImplementations§
Source§impl FixedChunker
impl FixedChunker
Trait Implementations§
Source§impl Chunker for FixedChunker
impl Chunker for FixedChunker
Source§impl Clone for FixedChunker
impl Clone for FixedChunker
Source§fn clone(&self) -> FixedChunker
fn clone(&self) -> FixedChunker
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FixedChunker
impl RefUnwindSafe for FixedChunker
impl Send for FixedChunker
impl Sync for FixedChunker
impl Unpin for FixedChunker
impl UnsafeUnpin for FixedChunker
impl UnwindSafe for FixedChunker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more