Skip to main content

DiscoveryOptions

Struct DiscoveryOptions 

Source
pub struct DiscoveryOptions {
    pub recursive: bool,
    pub follow_symlinks: bool,
    pub max_depth: Option<usize>,
    pub max_entries: Option<usize>,
    pub skip_directory_names: Vec<String>,
    pub skip_relative_prefixes: Vec<String>,
    pub skip_globs: Vec<String>,
    pub error_policy: TraversalErrorPolicy,
    pub deduplicate: bool,
    pub identity: PathIdentityOptions,
    pub sort: SortMode,
}
Available on crate feature listing only.
Expand description

Options for recursive directory discovery.

Skip rules are caller-configured. This crate does not hardcode node_modules, .git, target, etc.

§Depth model

Same as crate::listing::ListOptions:

  • Depth 0 — the walk root
  • Depth 1 — immediate children
  • recursive: false limits the walk to depth 0 only (the root)
  • recursive: true with max_depth: Some(n) uses walkdir max_depth = n

Fields§

§recursive: bool

Recurse into subdirectories.

§follow_symlinks: bool

Follow symbolic links (best-effort cycle detection via walkdir).

§max_depth: Option<usize>

Maximum walk depth relative to the root (None = unlimited when recursive).

Depth 0 is the root itself; 1 is immediate children. Ignored when recursive is false (only the root is considered).

§max_entries: Option<usize>

Maximum number of directories returned.

§skip_directory_names: Vec<String>

Directory names to skip (exact component match). Never applied to the root itself.

§skip_relative_prefixes: Vec<String>

Relative path prefixes (using / separators) to skip under the root.

§skip_globs: Vec<String>
Available on crate feature search only.

Glob patterns matched against relative paths (requires search / globset).

§error_policy: TraversalErrorPolicy

Error handling policy.

§deduplicate: bool

Deduplicate results by identity key.

§identity: PathIdentityOptions

Identity options used when deduplicate is true.

§sort: SortMode

Sort mode for the returned list.

Implementations§

Source§

impl DiscoveryOptions

Source

pub fn new() -> Self

Create default options (Self::default()).

Source

pub fn recursive(self, recursive: bool) -> Self

Enable or disable recursion.

Follow symlinks when walking.

Source

pub fn skip_names( self, names: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Skip exact directory names (e.g. "node_modules").

Source

pub fn skip_relative_prefixes( self, prefixes: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Skip relative path prefixes under the root.

Source

pub fn max_depth(self, depth: Option<usize>) -> Self

Set maximum depth (see module / type docs).

Source

pub fn max_entries(self, max: Option<usize>) -> Self

Set maximum number of returned directories.

Source

pub fn error_policy(self, policy: TraversalErrorPolicy) -> Self

Set error policy.

Source

pub fn deduplicate(self, deduplicate: bool) -> Self

Enable or disable identity-key deduplication.

Source

pub fn identity(self, identity: PathIdentityOptions) -> Self

Identity options used when deduplicating.

Source

pub fn sort(self, sort: SortMode) -> Self

Sort mode for the returned list.

Trait Implementations§

Source§

impl Clone for DiscoveryOptions

Source§

fn clone(&self) -> DiscoveryOptions

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 DiscoveryOptions

Source§

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

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

impl Default for DiscoveryOptions

Source§

fn default() -> Self

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

impl Eq for DiscoveryOptions

Source§

impl PartialEq for DiscoveryOptions

Source§

fn eq(&self, other: &DiscoveryOptions) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DiscoveryOptions

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.