file_source/paths_provider/
mod.rs

1//! Abstractions to allow configuring ways to provide the paths list for the
2//! file source to watch and read.
3
4#![deny(missing_docs)]
5
6use std::path::PathBuf;
7
8pub mod glob;
9
10/// Represents the ability to enumerate paths.
11///
12/// For use at [`crate::FileServer`].
13///
14/// # Notes
15///
16/// Ideally we'd use an iterator with bound lifetime here:
17///
18/// ```ignore
19/// type Iter<'a>: Iterator<Item = PathBuf> + 'a;
20/// fn paths(&self) -> Self::Iter<'_>;
21/// ```
22///
23/// However, that's currently unavailable at Rust.
24/// See: <https://github.com/rust-lang/rust/issues/44265>
25///
26/// We use an `IntoIter` here as a workaround.
27pub trait PathsProvider {
28    /// Provides the iterator that returns paths.
29    type IntoIter: IntoIterator<Item = PathBuf>;
30
31    /// Provides a set of paths.
32    fn paths(&self) -> Self::IntoIter;
33}