Skip to main content

LoadSettings

Struct LoadSettings 

Source
#[non_exhaustive]
pub struct LoadSettings { /* private fields */ }
Expand description

Bounds and filters of a folder walk. Every field has a safe default: the five text extensions, 10 000 files, 8 MiB per file, depth 16, 100 000 directory entries, symlinks not followed, hidden entries skipped. Built with Default and the with_* setters.

Implementations§

Source§

impl LoadSettings

Source

pub fn with_extensions<I, S>(self, extensions: I) -> LoadSettings
where I: IntoIterator<Item = S>, S: Into<String>,

Sets the file extensions to load, compared without case. Only txt, md, markdown, html and htm can be read; any other extension in the list is still skipped.

Source

pub fn with_max_files(self, max_files: usize) -> LoadSettings

Sets the most supported files one walk loads. A folder with more is an error, so a walk never stops halfway in silence. Default 10 000.

Source

pub fn with_max_file_bytes(self, max_file_bytes: u64) -> LoadSettings

Sets the largest file in bytes. A larger file is an error that names the source, checked from metadata before any read. Default 8 MiB.

Source

pub fn with_max_depth(self, max_depth: usize) -> LoadSettings

Sets the deepest folder level below the root, which is level 0. A folder deeper than this is an error that names it. Hidden folders are never entered, so they never trip it. Default 16.

Source

pub fn with_max_entries(self, max_entries: usize) -> LoadSettings

Sets the most directory entries one walk visits, of any kind. It bounds a walk through big folders of unsupported files; more entries is an error. Default 100 000.

Sets whether symlinks are followed. Off by default, because a link can point outside the folder the user chose. A link not followed is counted in Walked.symlinks.

Source

pub fn with_skip_hidden(self, skip: bool) -> LoadSettings

Sets whether entries whose name starts with a dot are skipped. On by default, so .git and editor files stay out. A skipped hidden entry is neither entered nor counted.

Source

pub fn extensions(&self) -> &[String]

Returns the extensions loaded, lowercase. Only the five readable text extensions can match a file. Default txt, md, markdown, html, htm.

Source

pub fn max_files(&self) -> usize

Returns the most supported files one walk loads. One more is an error naming the cap. Default 10 000.

Source

pub fn max_file_bytes(&self) -> u64

Returns the largest file in bytes. A larger file is an error naming the source. Default 8 MiB.

Source

pub fn max_depth(&self) -> usize

Returns the deepest folder level walked. The root is level 0. Default 16.

Source

pub fn max_entries(&self) -> usize

Returns the most directory entries one walk visits. Every entry counts, hidden or not. Default 100 000.

Returns whether symlinks are followed. A followed link is loaded like the file it points to. Default false.

Source

pub fn skip_hidden(&self) -> bool

Returns whether hidden entries are skipped. A hidden entry starts with a dot. Default true.

Trait Implementations§

Source§

impl Clone for LoadSettings

Source§

fn clone(&self) -> LoadSettings

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 LoadSettings

Source§

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

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

impl Default for LoadSettings

Source§

fn default() -> LoadSettings

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

impl Eq for LoadSettings

Source§

impl PartialEq for LoadSettings

Source§

fn eq(&self, other: &LoadSettings) -> 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 LoadSettings

Auto Trait Implementations§

§

impl Forget for LoadSettings

§

impl Freeze for LoadSettings

§

impl Move for LoadSettings

§

impl RefUnwindSafe for LoadSettings

§

impl Send for LoadSettings
where RawVecInner: Send,

§

impl Sync for LoadSettings
where RawVecInner: Sync,

§

impl Unpin for LoadSettings
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for LoadSettings

§

impl UnwindSafe for LoadSettings
where RawVecInner: UnwindSafe,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more