Skip to main content

RecordSet

Struct RecordSet 

Source
pub struct RecordSet {
    pub source: String,
    pub format: String,
    pub columns: Vec<Column>,
}
Expand description

A normalized corpus: named columns of equal length, plus provenance about where it came from. This is the universal input to every detector.

Fields§

§source: String

Logical source identifier (path, URL, or "-" for stdin).

§format: String

The format the normalizer recognized (e.g. "csv", "ndjson").

§columns: Vec<Column>

Implementations§

Source§

impl RecordSet

Source

pub fn new( source: impl Into<String>, format: impl Into<String>, columns: Vec<Column>, ) -> Self

Creates a record set, panicking only via debug-assert if columns are ragged. Construction is the normalizer’s responsibility; detectors may rely on rectangularity.

Source

pub fn rows(&self) -> usize

Number of rows (length of the first column, or 0 if columnless).

Source

pub fn width(&self) -> usize

Source

pub fn column(&self, name: &str) -> Option<&Column>

Source

pub fn select(&self, names: &[String]) -> RecordSet

A copy keeping only the columns named in names, in their original column order (not the order given). Names with no matching column are silently skipped — callers that must reject an unknown name should validate with Self::column first. Provenance is preserved.

This is the column-scoping primitive behind scan --columns: it lets a caller focus detection on a handful of meaningful columns in a wide corpus (e.g. journald’s dozens of identifier/counter fields).

Source

pub fn without(&self, names: &[String]) -> RecordSet

A copy dropping the columns named in names, preserving the order and provenance of the rest. The complement of Self::select, behind scan --exclude.

Trait Implementations§

Source§

impl Clone for RecordSet

Source§

fn clone(&self) -> RecordSet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RecordSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RecordSet

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for RecordSet

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,