pub struct Line { /* private fields */ }Expand description
Zero-copy line representation that points directly into memory-mapped data
Implementations§
Source§impl Line
impl Line
Sourcepub unsafe fn as_bytes(&self) -> &[u8] ⓘ
pub unsafe fn as_bytes(&self) -> &[u8] ⓘ
Get the line data as a byte slice
§Safety
The caller must ensure that:
- The memory this Line points to is still valid (not freed)
- The memory-mapped file has not been unmapped
- No other code is mutating this memory region
Sourcepub fn extract_field(
&self,
field_num: usize,
separator: Option<char>,
) -> Option<&[u8]>
pub fn extract_field( &self, field_num: usize, separator: Option<char>, ) -> Option<&[u8]>
Extract a field from the line based on field separator Fields are 1-indexed (field 1 is the first field)
Sourcepub fn extract_key(
&self,
key: &SortKey,
separator: Option<char>,
) -> Option<&[u8]>
pub fn extract_key( &self, key: &SortKey, separator: Option<char>, ) -> Option<&[u8]>
Extract a key region from the line based on SortKey specification
Sourcepub fn parse_int(&self) -> Option<i64>
pub fn parse_int(&self) -> Option<i64>
Fast numeric parsing for simple integers (optimized path)
Sourcepub fn parse_general_numeric(&self) -> f64
pub fn parse_general_numeric(&self) -> f64
Parse as general numeric (supports scientific notation, inf, nan)
Sourcepub fn compare_general_numeric(&self, other: &Line) -> Ordering
pub fn compare_general_numeric(&self, other: &Line) -> Ordering
Compare as general numeric values (scientific notation support)
Sourcepub fn compare_with_keys(
&self,
other: &Line,
keys: &[SortKey],
separator: Option<char>,
config: &SortConfig,
) -> Ordering
pub fn compare_with_keys( &self, other: &Line, keys: &[SortKey], separator: Option<char>, config: &SortConfig, ) -> Ordering
Compare lines using field-based sorting with multiple keys
Sourcepub fn compare_with_config(&self, other: &Line, config: &SortConfig) -> Ordering
pub fn compare_with_config(&self, other: &Line, config: &SortConfig) -> Ordering
Compare lines based on global configuration (when no keys are specified)
Sourcepub fn compare_numeric(&self, other: &Line) -> Ordering
pub fn compare_numeric(&self, other: &Line) -> Ordering
Fast comparison for numeric values (GNU sort style - no string conversion)
Sourcepub fn compare_ignore_case(&self, other: &Line) -> Ordering
pub fn compare_ignore_case(&self, other: &Line) -> Ordering
Locale-aware case-insensitive comparison
Sourcepub fn compare_lexicographic(&self, other: &Line) -> Ordering
pub fn compare_lexicographic(&self, other: &Line) -> Ordering
Locale-aware lexicographic comparison
Sourcepub fn compare_lexicographic_with_blanks(
&self,
other: &Line,
ignore_leading_blanks: bool,
) -> Ordering
pub fn compare_lexicographic_with_blanks( &self, other: &Line, ignore_leading_blanks: bool, ) -> Ordering
Lexicographic comparison with option to ignore leading blanks
Sourcepub fn compare_dictionary_order(&self, other: &Line) -> Ordering
pub fn compare_dictionary_order(&self, other: &Line) -> Ordering
Dictionary order comparison (only alphanumeric characters and blanks)
Sourcepub fn compare_dictionary_order_ignore_case(&self, other: &Line) -> Ordering
pub fn compare_dictionary_order_ignore_case(&self, other: &Line) -> Ordering
Dictionary order with case-insensitive comparison
Sourcepub fn compare_month(&self, other: &Line) -> Ordering
pub fn compare_month(&self, other: &Line) -> Ordering
Month-aware comparison (GNU sort compatible)
Sourcepub fn compare_version(&self, other: &Line) -> Ordering
pub fn compare_version(&self, other: &Line) -> Ordering
Version-aware comparison (GNU sort -V compatible)
Sourcepub fn compare_human_numeric(&self, other: &Line) -> Ordering
pub fn compare_human_numeric(&self, other: &Line) -> Ordering
Human numeric comparison (GNU sort -h compatible)
Trait Implementations§
impl Copy for Line
impl Send for Line
impl Sync for Line
Auto Trait Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more