pub struct Sort { /* private fields */ }Expand description
A transform that sorts rows by one or more columns.
§Example
ⓘ
use alimentar::{Sort, SortOrder};
// Sort by single column ascending
let sort = Sort::by("age");
// Sort by column descending
let sort = Sort::by("score").order(SortOrder::Descending);
// Sort by multiple columns
let sort = Sort::by_columns(vec![("name", SortOrder::Ascending), ("age", SortOrder::Descending)]);Implementations§
Source§impl Sort
impl Sort
Sourcepub fn by<S: Into<String>>(column: S) -> Self
pub fn by<S: Into<String>>(column: S) -> Self
Creates a Sort transform for a single column (ascending by default).
Sourcepub fn by_columns<S: Into<String>>(
columns: impl IntoIterator<Item = (S, SortOrder)>,
) -> Self
pub fn by_columns<S: Into<String>>( columns: impl IntoIterator<Item = (S, SortOrder)>, ) -> Self
Creates a Sort transform for multiple columns with specified orders.
Sourcepub fn nulls_first(self, nulls_first: bool) -> Self
pub fn nulls_first(self, nulls_first: bool) -> Self
Sets whether nulls should appear first (default: false, nulls last).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sort
impl RefUnwindSafe for Sort
impl Send for Sort
impl Sync for Sort
impl Unpin for Sort
impl UnwindSafe for Sort
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