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 true_() -> SelectionCompact
fn true_() -> SelectionCompact
The universal selection (matches all nodes).
Source§fn false_() -> SelectionCompact
fn false_() -> SelectionCompact
The identity selection (matches no nodes).
Source§fn first(_: SelectionCompact) -> SelectionCompact
fn first(_: SelectionCompact) -> SelectionCompact
Selects the first index along the current dimension for which
the inner selection is non-empty.
Source§fn all(s: SelectionCompact) -> SelectionCompact
fn all(s: SelectionCompact) -> SelectionCompact
Selects all values along the current dimension, then applies
the inner selection.
Source§fn range<R>(range: R, s: SelectionCompact) -> SelectionCompact
fn range<R>(range: R, s: SelectionCompact) -> SelectionCompact
Selects values within the given range along the current
dimension, then applies the inner selection.
Source§fn label<L>(labels: Vec<L>, s: SelectionCompact) -> SelectionCompact
fn label<L>(labels: Vec<L>, s: SelectionCompact) -> SelectionCompact
Selects values along the current dimension that match the
given labels, then applies the inner selection.
Source§fn any(s: SelectionCompact) -> SelectionCompact
fn any(s: SelectionCompact) -> SelectionCompact
Selects a random index along the current dimension, then applies
the inner selection.
Source§fn intersection(a: SelectionCompact, b: SelectionCompact) -> SelectionCompact
fn intersection(a: SelectionCompact, b: SelectionCompact) -> SelectionCompact
The intersection (logical AND) of two selection expressions.
Source§fn union(a: SelectionCompact, b: SelectionCompact) -> SelectionCompact
fn union(a: SelectionCompact, b: SelectionCompact) -> SelectionCompact
The union (logical OR) 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§
§impl<T> AnySync for T
impl<T> AnySync for T
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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