pub struct SortOptions {
pub descending: bool,
pub nulls_first: bool,
}
Expand description
Options that define the sort order of a given column
The default sorts equivalently to of ASC NULLS FIRST
in SQL (i.e.
ascending order with nulls sorting before any other values).
§Example creation
// configure using explicit initialization
let options = SortOptions {
descending: false,
nulls_first: true,
};
// Default is ASC NULLs First
assert_eq!(options, SortOptions::default());
assert_eq!(options.to_string(), "ASC NULLS FIRST");
// Configure using builder APIs
let options = SortOptions::default()
.desc()
.nulls_first();
assert_eq!(options.to_string(), "DESC NULLS FIRST");
// configure using explicit field values
let options = SortOptions::default()
.with_descending(false)
.with_nulls_first(false);
assert_eq!(options.to_string(), "ASC NULLS LAST");
§Example operations
It is also possible to negate the sort options using the !
operator.
use arrow_schema::SortOptions;
let options = !SortOptions::default();
assert_eq!(options.to_string(), "DESC NULLS LAST");
Fields§
§descending: bool
Whether to sort in descending order
nulls_first: bool
Whether to sort nulls first
Implementations§
source§impl SortOptions
impl SortOptions
sourcepub fn new(descending: bool, nulls_first: bool) -> SortOptions
pub fn new(descending: bool, nulls_first: bool) -> SortOptions
Create a new SortOptions
struct
sourcepub fn desc(self) -> SortOptions
pub fn desc(self) -> SortOptions
Set this sort options to sort in descending order
See Self::with_descending to explicitly set the underlying field
sourcepub fn asc(self) -> SortOptions
pub fn asc(self) -> SortOptions
Set this sort options to sort in ascending order
See Self::with_descending to explicitly set the underlying field
sourcepub fn nulls_first(self) -> SortOptions
pub fn nulls_first(self) -> SortOptions
Set this sort options to sort nulls first
See Self::with_nulls_first to explicitly set the underlying field
sourcepub fn nulls_last(self) -> SortOptions
pub fn nulls_last(self) -> SortOptions
Set this sort options to sort nulls last
See Self::with_nulls_first to explicitly set the underlying field
sourcepub fn with_descending(self, descending: bool) -> SortOptions
pub fn with_descending(self, descending: bool) -> SortOptions
Set this sort options to sort descending if argument is true
sourcepub fn with_nulls_first(self, nulls_first: bool) -> SortOptions
pub fn with_nulls_first(self, nulls_first: bool) -> SortOptions
Set this sort options to sort nulls first if argument is true
Trait Implementations§
source§impl Clone for SortOptions
impl Clone for SortOptions
source§fn clone(&self) -> SortOptions
fn clone(&self) -> SortOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SortOptions
impl Debug for SortOptions
source§impl Default for SortOptions
impl Default for SortOptions
source§fn default() -> SortOptions
fn default() -> SortOptions
source§impl Display for SortOptions
impl Display for SortOptions
source§impl Hash for SortOptions
impl Hash for SortOptions
source§impl Not for SortOptions
impl Not for SortOptions
!
operator is overloaded for SortOptions
to invert boolean
fields of the struct.
§type Output = SortOptions
type Output = SortOptions
!
operator.source§fn not(self) -> SortOptions
fn not(self) -> SortOptions
!
operation. Read moresource§impl Ord for SortOptions
impl Ord for SortOptions
source§fn cmp(&self, other: &SortOptions) -> Ordering
fn cmp(&self, other: &SortOptions) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for SortOptions
impl PartialEq for SortOptions
source§impl PartialOrd for SortOptions
impl PartialOrd for SortOptions
impl Copy for SortOptions
impl Eq for SortOptions
impl StructuralPartialEq for SortOptions
Auto Trait Implementations§
impl Freeze for SortOptions
impl RefUnwindSafe for SortOptions
impl Send for SortOptions
impl Sync for SortOptions
impl Unpin for SortOptions
impl UnwindSafe for SortOptions
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)