Struct SortOptions
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§
§impl SortOptions
impl SortOptions
pub fn new(descending: bool, nulls_first: bool) -> SortOptions
pub fn new(descending: bool, nulls_first: bool) -> SortOptions
Create a new SortOptions
struct
pub 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
pub 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
pub 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
pub 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
pub 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
pub 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§
§impl Clone for SortOptions
impl Clone for SortOptions
§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 more§impl Debug for SortOptions
impl Debug for SortOptions
§impl Default for SortOptions
impl Default for SortOptions
§fn default() -> SortOptions
fn default() -> SortOptions
§impl Display for SortOptions
impl Display for SortOptions
§impl Hash for SortOptions
impl Hash for SortOptions
§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.§fn not(self) -> SortOptions
fn not(self) -> SortOptions
!
operation. Read more§impl Ord for SortOptions
impl Ord for SortOptions
§impl PartialEq for SortOptions
impl PartialEq for SortOptions
§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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)