pub struct SortMultipleOptions {
pub descending: Vec<bool>,
pub nulls_last: Vec<bool>,
pub multithreaded: bool,
pub maintain_order: bool,
pub limit: Option<(u32, 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
.
limit: Option<(u32, bool)>
Limit a sort output, this is for optimization purposes and might be ignored.
- Len
- Descending
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
Sort order for all columns. Default false
which is ascending.
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<'de> Deserialize<'de> for SortMultipleOptions
impl<'de> Deserialize<'de> for SortMultipleOptions
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SortMultipleOptions, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SortMultipleOptions, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
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
Source§impl Serialize for SortMultipleOptions
impl Serialize for SortMultipleOptions
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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