Line

Struct Line 

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

Zero-copy line representation that points directly into memory-mapped data

Implementations§

Source§

impl Line

Source

pub fn new(data: &[u8]) -> Self

Create a new Line from a slice

Source

pub unsafe fn as_bytes(&self) -> &[u8]

Get the line data as a byte slice

§Safety

The caller must ensure that:

  1. The memory this Line points to is still valid (not freed)
  2. The memory-mapped file has not been unmapped
  3. No other code is mutating this memory region
Source

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)

Source

pub fn extract_key( &self, key: &SortKey, separator: Option<char>, ) -> Option<&[u8]>

Extract a key region from the line based on SortKey specification

Source

pub fn parse_int(&self) -> Option<i64>

Fast numeric parsing for simple integers (optimized path)

Source

pub fn parse_general_numeric(&self) -> f64

Parse as general numeric (supports scientific notation, inf, nan)

Source

pub fn compare_general_numeric(&self, other: &Line) -> Ordering

Compare as general numeric values (scientific notation support)

Source

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

Source

pub fn compare_with_config(&self, other: &Line, config: &SortConfig) -> Ordering

Compare lines based on global configuration (when no keys are specified)

Source

pub fn compare_numeric(&self, other: &Line) -> Ordering

Fast comparison for numeric values (GNU sort style - no string conversion)

Source

pub fn len(&self) -> usize

Get the length of the line

Source

pub fn is_empty(&self) -> bool

Check if the line is empty

Source

pub fn compare_ignore_case(&self, other: &Line) -> Ordering

Locale-aware case-insensitive comparison

Source

pub fn compare_lexicographic(&self, other: &Line) -> Ordering

Locale-aware lexicographic comparison

Source

pub fn compare_lexicographic_with_blanks( &self, other: &Line, ignore_leading_blanks: bool, ) -> Ordering

Lexicographic comparison with option to ignore leading blanks

Source

pub fn compare_dictionary_order(&self, other: &Line) -> Ordering

Dictionary order comparison (only alphanumeric characters and blanks)

Source

pub fn compare_dictionary_order_ignore_case(&self, other: &Line) -> Ordering

Dictionary order with case-insensitive comparison

Source

pub fn compare_month(&self, other: &Line) -> Ordering

Month-aware comparison (GNU sort compatible)

Source

pub fn compare_version(&self, other: &Line) -> Ordering

Version-aware comparison (GNU sort -V compatible)

Source

pub fn compare_human_numeric(&self, other: &Line) -> Ordering

Human numeric comparison (GNU sort -h compatible)

Trait Implementations§

Source§

impl Clone for Line

Source§

fn clone(&self) -> Line

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Line

Source§

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

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

impl Copy for Line

Source§

impl Send for Line

Source§

impl Sync for Line

Auto Trait Implementations§

§

impl Freeze for Line

§

impl RefUnwindSafe for Line

§

impl Unpin for Line

§

impl UnwindSafe for Line

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V