pub struct Row {
pub file: String,
pub line: usize,
pub index: usize,
pub cols: Vec<String>,
pub header: Arc<Vec<String>>,
}Expand description
One data row of a fixture file.
Fields§
§file: StringBase name of the file this row came from (happy.tsv).
line: usizePhysical 1-based line number within that file.
index: usize0-based position among the file’s DATA rows (header and skipped lines do not advance it).
cols: Vec<String>The row’s columns, exactly as they appear in the file.
header: Arc<Vec<String>>The file’s header names, shared with every row of the file.
Implementations§
Source§impl Row
impl Row
Sourcepub fn col(&self, i: usize) -> &str
pub fn col(&self, i: usize) -> &str
Raw column by position. Out of range is "": a fixture with a
trailing optional column should not need a length check at every
use.
Sourcepub fn unesc(&self, i: usize) -> String
pub fn unesc(&self, i: usize) -> String
Escape-decoded column by position. This is what a parser input column goes through.
Sourcepub fn index_of(&self, name: &str) -> Option<usize>
pub fn index_of(&self, name: &str) -> Option<usize>
Position of a header name, or None when the file has no such
column.
Sourcepub fn named(&self, name: &str) -> &str
pub fn named(&self, name: &str) -> &str
Raw column by header name; "" when there is no such column.
Sourcepub fn unesc_named(&self, name: &str) -> String
pub fn unesc_named(&self, name: &str) -> String
Escape-decoded column by header name.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Row
impl Freeze for Row
impl Move for Row
impl RefUnwindSafe for Row
impl Send for Row
impl Sync for Row
impl Unpin for Row
impl UnsafeUnpin for Rowwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
*const ArcInner<Vec<String>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Vec<String>>>: UnsafeUnpin,
impl UnwindSafe for Row
Blanket Implementations§
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