#[non_exhaustive]pub struct SortField {
pub field: String,
pub dir: SortDir,
}Expand description
Sort field with direction.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.field: StringThe column name to sort by.
dir: SortDirThe sort direction (ascending or descending).
Implementations§
Source§impl SortField
impl SortField
Sourcepub fn parse_sort_string(
sort: &str,
allowed: &[&str],
) -> Result<Vec<Self>, String>
pub fn parse_sort_string( sort: &str, allowed: &[&str], ) -> Result<Vec<Self>, String>
Parse a sort string like “name,-created_at” into sort fields.
Fields prefixed with - are sorted descending.
Validates against allowed fields list.
§Security Note
If allowed is empty, ALL fields are allowed. For user input, always
provide an explicit whitelist to prevent sorting by sensitive columns.
Trait Implementations§
impl Eq for SortField
impl StructuralPartialEq for SortField
Auto Trait Implementations§
impl Freeze for SortField
impl RefUnwindSafe for SortField
impl Send for SortField
impl Sync for SortField
impl Unpin for SortField
impl UnwindSafe for SortField
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