pub struct SortMultipleOptions {
pub descending: Vec<bool>,
pub nulls_last: Vec<bool>,
pub multithreaded: bool,
pub maintain_order: bool,
}
Expand description
Sort options for multi-series sorting.
Indicating the order of sorting, nulls position, multithreading, and maintaining order.
§Example
let df = df! {
"a" => [Some(1), Some(2), None, Some(4), None],
"b" => [Some(5), None, Some(3), Some(2), Some(1)]
}?;
let out = df
.sort(
["a", "b"],
SortMultipleOptions::default()
.with_maintain_order(true)
.with_multithreaded(false)
.with_order_descending_multi([false, true])
.with_nulls_last(true),
)?;
let expected = df! {
"a" => [Some(1), Some(2), Some(4), None, None],
"b" => [Some(5), None, Some(2), Some(3), Some(1)]
}?;
assert_eq!(out, expected);
Fields§
§descending: Vec<bool>
Order of the columns. Default all `false``.
If only one value is given, it will broadcast to all columns.
Use SortMultipleOptions::with_order_descending_multi
or SortMultipleOptions::with_order_descending
to modify.
§Safety
Len must match the number of columns, or equal 1.
nulls_last: Vec<bool>
Whether place null values last. Default false
.
multithreaded: bool
Whether sort in multiple threads. Default true
.
maintain_order: bool
Whether maintain the order of equal elements. Default false
.
Implementations§
Source§impl SortMultipleOptions
impl SortMultipleOptions
Sourcepub fn new() -> SortMultipleOptions
pub fn new() -> SortMultipleOptions
Create SortMultipleOptions
with default values.
Sourcepub fn with_order_descending_multi(
self,
descending: impl IntoIterator<Item = bool>,
) -> SortMultipleOptions
pub fn with_order_descending_multi( self, descending: impl IntoIterator<Item = bool>, ) -> SortMultipleOptions
Specify order for each column. Defaults all false
.
§Safety
Len must match the number of columns, or be equal to 1.
Sourcepub fn with_order_descending(self, descending: bool) -> SortMultipleOptions
pub fn with_order_descending(self, descending: bool) -> SortMultipleOptions
Implement order for all columns. Default false
.
Sourcepub fn with_nulls_last_multi(
self,
nulls_last: impl IntoIterator<Item = bool>,
) -> SortMultipleOptions
pub fn with_nulls_last_multi( self, nulls_last: impl IntoIterator<Item = bool>, ) -> SortMultipleOptions
Specify whether to place nulls last, per-column. Defaults all false
.
§Safety
Len must match the number of columns, or be equal to 1.
Sourcepub fn with_nulls_last(self, enabled: bool) -> SortMultipleOptions
pub fn with_nulls_last(self, enabled: bool) -> SortMultipleOptions
Whether to place null values last. Default false
.
Sourcepub fn with_multithreaded(self, enabled: bool) -> SortMultipleOptions
pub fn with_multithreaded(self, enabled: bool) -> SortMultipleOptions
Whether to sort in multiple threads. Default true
.
Sourcepub fn with_maintain_order(self, enabled: bool) -> SortMultipleOptions
pub fn with_maintain_order(self, enabled: bool) -> SortMultipleOptions
Whether to maintain the order of equal elements. Default false
.
Sourcepub fn with_order_reversed(self) -> SortMultipleOptions
pub fn with_order_reversed(self) -> SortMultipleOptions
Reverse the order of sorting for each column.
Trait Implementations§
Source§impl Clone for SortMultipleOptions
impl Clone for SortMultipleOptions
Source§fn clone(&self) -> SortMultipleOptions
fn clone(&self) -> SortMultipleOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SortMultipleOptions
impl Debug for SortMultipleOptions
Source§impl Default for SortMultipleOptions
impl Default for SortMultipleOptions
Source§fn default() -> SortMultipleOptions
fn default() -> SortMultipleOptions
Source§impl From<&SortMultipleOptions> for SortOptions
impl From<&SortMultipleOptions> for SortOptions
Source§fn from(value: &SortMultipleOptions) -> SortOptions
fn from(value: &SortMultipleOptions) -> SortOptions
Source§impl From<&SortOptions> for SortMultipleOptions
impl From<&SortOptions> for SortMultipleOptions
Source§fn from(value: &SortOptions) -> SortMultipleOptions
fn from(value: &SortOptions) -> SortMultipleOptions
Source§impl Hash for SortMultipleOptions
impl Hash for SortMultipleOptions
Source§impl PartialEq for SortMultipleOptions
impl PartialEq for SortMultipleOptions
impl Eq for SortMultipleOptions
impl StructuralPartialEq for SortMultipleOptions
Auto Trait Implementations§
impl Freeze for SortMultipleOptions
impl RefUnwindSafe for SortMultipleOptions
impl Send for SortMultipleOptions
impl Sync for SortMultipleOptions
impl Unpin for SortMultipleOptions
impl UnwindSafe for SortMultipleOptions
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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