Skip to main content

Selection

Struct Selection 

Source
pub struct Selection {
Show 13 fields pub include: Vec<Pattern>, pub exclude: Vec<Pattern>, pub min_size: Option<u64>, pub kinds: Vec<EntryKind>, pub modified: ModifiedWindow, pub ignored: IgnoredEntries, pub depth: Option<Bound>, pub min_share: Option<ShareThreshold>, pub breadth: Option<Bound>, pub limit: Option<Bound>, pub sort: Option<SortKey>, pub reverse: bool, pub size: SizeMetric,
}
Expand description

Which retained entries a query considers, and how its results are shaped.

Fields§

§include: Vec<Pattern>

Patterns an entry must match at least one of, when non-empty.

§exclude: Vec<Pattern>

Patterns that exclude an entry outright; exclusion wins over inclusion.

§min_size: Option<u64>

Smallest size, in the selected metric, an entry may have.

§kinds: Vec<EntryKind>

Entry kinds to consider; empty means every kind.

§modified: ModifiedWindow

Modification-time window.

§ignored: IgnoredEntries

Entries to consider by .gitignore classification.

Anything but IgnoredEntries::Include needs an index that observed control state; crate::query::Request::validate refuses it otherwise.

§depth: Option<Bound>

How deep a rendered tree descends, or None to let each view apply its own.

Optional for the same reason limit and sort are. The depth that suits a tree is not the depth that suits a flat enumeration, and while this was a plain Bound the only default the library could offer was “unbounded” – so the CLI declared default_value = "2" itself and every other caller silently got a different report for the same request.

§min_share: Option<ShareThreshold>

Minimum displayed share of the selected root, as an exact percentage.

§breadth: Option<Bound>

Maximum immediate child rows displayed per directory.

§limit: Option<Bound>

How many entries a view reports. Rows to keep, or None to let each view apply its own bound.

Optional for the same reason sort is: a bound that suits a per-directory tree is not the bound that suits a complete enumeration, and a single shared default produced “the ten alphabetically-first entries” of a 192,871-entry tree.

§sort: Option<SortKey>

Ordering key, or None to let each view apply its own default.

Optional rather than defaulted here because the sensible default differs by view: a tree and a type breakdown rank by size, while a flat file listing reads in name order. One shared default would be wrong for one of them.

§reverse: bool

Whether the ordering is reversed.

§size: SizeMetric

Which size metric the report answers in.

Implementations§

Source§

impl Selection

Source

pub fn is_unfiltered(&self) -> bool

Whether this selection constrains which entries are considered.

An unconstrained selection lets a view read pre-computed roll-up state directly instead of traversing entries, which is the difference between the two performance tiers a report can run in.

Source

pub fn admits(&self, candidate: &Candidate<'_>) -> bool

Whether an entry passes every filter.

Source

pub fn size_of(&self, candidate: &Candidate<'_>) -> u64

The size of an entry in the selected metric.

Trait Implementations§

Source§

impl Clone for Selection

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Selection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Selection

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<Selection> for EntrySelection

Source§

fn from(query: Selection) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.