pub struct SelectionCompact(/* private fields */);
Expand description
A structured formatter that renders Selection
expressions in
compact surface syntax.
This type implements SelectionSYM
and emits selection
expressions using the same textual format accepted by both:
- The [
sel!
] macro (defined in thehypermesh_macros
crate) - The string-based
parse
function
Examples of this syntax include:
*
0, 1..4, *
["A100"]?
(0, (0 | 2), *) & (0, *, *)
— intersection of two 3D expressions; simplifies to just0, (0 | 2), *
since the second operand is a superset
Used internally by the compact
helper and [Selection::fmt
]
to produce concise, user-facing representations of selection
expressions.
§Example
use ndslice::selection::dsl::*;
use ndslice::selection::pretty::compact;
let expr = all(range(0..4, true_()));
println!("{}", compact(&expr)); // prints: (*, 0..4)
Trait Implementations§
Source§impl Display for SelectionCompact
impl Display for SelectionCompact
Source§impl SelectionSYM for SelectionCompact
impl SelectionSYM for SelectionCompact
Source§fn first(_: Self) -> Self
fn first(_: Self) -> Self
Selects the first index along the current dimension for which
the inner selection is non-empty.
Source§fn all(s: Self) -> Self
fn all(s: Self) -> Self
Selects all values along the current dimension, then applies
the inner selection.
Source§fn range<R: Into<Range>>(range: R, s: Self) -> Self
fn range<R: Into<Range>>(range: R, s: Self) -> Self
Selects values within the given range along the current
dimension, then applies the inner selection.
Source§fn label<L: Into<LabelKey>>(labels: Vec<L>, s: Self) -> Self
fn label<L: Into<LabelKey>>(labels: Vec<L>, s: Self) -> Self
Selects values along the current dimension that match the
given labels, then applies the inner selection.
Source§fn any(s: Self) -> Self
fn any(s: Self) -> Self
Selects a random index along the current dimension, then applies
the inner selection.
Source§fn intersection(a: Self, b: Self) -> Self
fn intersection(a: Self, b: Self) -> Self
The intersection (logical AND) of two selection expressions.
Auto Trait Implementations§
impl Freeze for SelectionCompact
impl RefUnwindSafe for SelectionCompact
impl Send for SelectionCompact
impl Sync for SelectionCompact
impl Unpin for SelectionCompact
impl UnwindSafe for SelectionCompact
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> 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>
Converts
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>
Converts
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