Struct Core

Source
pub struct Core<'a, L> { /* private fields */ }
Expand description

The main processing loop

Implementations§

Source§

impl<'a, L> Core<'a, L>
where L: LineParser<'a>,

Source

pub fn new( config: &'a CoreConfig<'_>, fields: &'a [FieldRange], line_parser: L, line_buffer: &'a mut LineBuffer, ) -> Self

Create a new “core” the can be used to parse multiple inputs

Source

pub fn hck_input<P, W>( &mut self, input: HckInput<P>, output: W, header: Option<Vec<u8>>, ) -> Result<(), Error>
where P: AsRef<Path>, W: Write,

Source

pub fn hck_bytes<W>(&mut self, bytes: &[u8], output: W) -> Result<(), Error>
where W: Write,

Iterate over the lines in a slice of bytes.

The input slice of bytes is assumed to end in a newline.

Source

pub fn hck_bytes_fast<W: Write>( &mut self, bytes: &[u8], output: W, ) -> Result<(), Error>

Fast mode iteration over lines in a slice of bytes.

This expects the seperator to be a single byte and the newline to be a singel byte.

Instead of seaching for linebreaks, then splitting up the line on the sep, fast mode looks for either sep or newline at the same time, so instead of two passes over the bytes we only make one pass.

Source

pub fn hck_reader_fast<R: Read, W: Write>( &mut self, reader: R, output: W, ) -> Result<(), Error>

Fast mode iteration over lines in a reader.

This expects the separator to be a single byte and the newline to be a single byte.

Instead of seaching for linebreaks, then splitting up the line on the sep, fast mode looks for either sep or newline at the same time, so instead of two passes over the bytes we only make one pass.

Source

pub fn hck_reader<R: Read, W: Write>( &mut self, reader: R, output: W, ) -> Result<(), Error>

Process lines from a reader.

Auto Trait Implementations§

§

impl<'a, L> Freeze for Core<'a, L>
where L: Freeze,

§

impl<'a, L> RefUnwindSafe for Core<'a, L>
where L: RefUnwindSafe,

§

impl<'a, L> Send for Core<'a, L>
where L: Send,

§

impl<'a, L> Sync for Core<'a, L>
where L: Sync,

§

impl<'a, L> Unpin for Core<'a, L>
where L: Unpin,

§

impl<'a, L> !UnwindSafe for Core<'a, L>

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.