pub struct TextSink { /* private fields */ }Expand description
Accumulates extracted text under a hard character budget.
The budget is checked before every push, so a pathological document
truncates instead of exhausting memory. TextSink::truncated reports
whether anything was dropped, which callers surface as a warn!.
Implementations§
Source§impl TextSink
impl TextSink
pub fn new(budget: usize) -> Self
pub fn is_empty(&self) -> bool
Sourcepub fn len_chars(&self) -> usize
pub fn len_chars(&self) -> usize
Chars accumulated so far. Maintained incrementally, so callers folding many sinks into one document-wide total pay nothing for asking.
pub fn truncated(&self) -> bool
Sourcepub fn remaining(&self) -> usize
pub fn remaining(&self) -> usize
Remaining budget — lets a caller stop walking documents entirely once the total cap is reached.
pub fn into_string(self) -> String
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TextSink
impl RefUnwindSafe for TextSink
impl Send for TextSink
impl Sync for TextSink
impl Unpin for TextSink
impl UnsafeUnpin for TextSink
impl UnwindSafe for TextSink
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more