Skip to main content

StreamCleaner

Struct StreamCleaner 

Source
pub struct StreamCleaner { /* private fields */ }
Expand description

Incremental cleaner that processes text in newline-delimited chunks.

Implementations§

Source§

impl StreamCleaner

Source

pub fn new(options: CleaningOptions) -> Self

Construct a streaming cleaner from options.

§Arguments
  • options: Cleaning behavior configuration.
§Returns

A new StreamCleaner.

Source

pub fn from_cleaner(cleaner: TextCleaner) -> Self

Construct a streaming cleaner from an existing TextCleaner.

§Arguments
  • cleaner: Preconfigured text cleaner.
§Returns

A new StreamCleaner.

Source

pub fn feed<'out>( &mut self, chunk: &str, out: &'out mut String, ) -> Option<CleaningResult<'out>>

Feed one input chunk and emit cleaned output only after a newline boundary is available.

§Arguments
  • chunk: Incoming text data.
  • out: Reusable output buffer.
§Returns

Some(CleaningResult) when at least one complete line was processed, otherwise None.

§Panics

Panics when normalization is requested but the unorm feature is disabled.

Source

pub fn finish<'out>( &mut self, out: &'out mut String, ) -> Option<CleaningResult<'out>>

Flush remaining buffered text at end-of-stream.

§Arguments
  • out: Reusable output buffer.
§Returns

Final cleaned chunk when buffered content remains, otherwise None.

Source

pub fn summary(&self) -> StreamSummary

Return cumulative stream statistics.

§Returns

Aggregate counters and total change count.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,