Column

Struct Column 

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

A simple interface for building and adding new columns.

You’ll always start from a column name with_name and then decide if you want to build the new column’s value from previous columns or from a specific one using a regex.

§Example

use csvsc::prelude::*;

Column::with_name("full name").from_all_previous().definition("{name} {last name}");

Implementations§

Source§

impl Column

Source

pub fn with_name(name: &str) -> Column

Start your new column with a name

Source

pub fn from_all_previous(self) -> MixColumn

Build the new column’s value from the values of existing columns so far

Source

pub fn from_column(self, name: &str) -> IncompleteRegexColumn

Build the new column’s value from a single column and a regex that you’ll use to extract some values.

This is very useful for adding data contained in the csv file’s name that is contained in the _source column (automatically added).

§Example
use csvsc::prelude::*;

Column::with_name("year")
    .from_column("_source")
    .with_regex("report_([0-9]{4}).csv").unwrap()
    .definition("$1");

Auto Trait Implementations§

§

impl Freeze for Column

§

impl RefUnwindSafe for Column

§

impl Send for Column

§

impl Sync for Column

§

impl Unpin for Column

§

impl UnwindSafe for Column

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.