pub struct Sort {
pub direction: Direction,
pub field: Path,
/* private fields */
}
Expand description
A single sort instruction containing a direction and field path.
Fields§
§direction: Direction
The direction to sort by.
field: Path
The name of the field to sort by.
Implementations§
Source§impl Sort
impl Sort
Sourcepub fn reverse(&self) -> Self
pub fn reverse(&self) -> Self
Returns a cloned inverse of self
.
§Example
use json_api::query::{Direction, Sort};
let chrono = Sort::new("created-at".parse()?, Direction::Asc);
let latest = chrono.reverse();
assert_eq!(chrono.field, latest.field);
assert_eq!(chrono.direction, Direction::Asc);
assert_eq!(latest.direction, Direction::Desc);
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Sort
impl<'de> Deserialize<'de> for Sort
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Sort
impl StructuralPartialEq for Sort
Auto Trait Implementations§
impl Freeze for Sort
impl RefUnwindSafe for Sort
impl Send for Sort
impl Sync for Sort
impl Unpin for Sort
impl UnwindSafe for Sort
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Compare self to
key
and return true
if they are equal.