Enum find_folder::Search
source · pub enum Search {
Parents(ParentsDepth),
Kids(KidsDepth),
ParentsThenKids(ParentsDepth, KidsDepth),
KidsThenParents(KidsDepth, ParentsDepth),
}
Expand description
The direction in which find_folder
should search for the folder.
Variants§
Parents(ParentsDepth)
Search recursively through parent directories with the given depth.
Kids(KidsDepth)
Search recursively through children directories with the given depth.
ParentsThenKids(ParentsDepth, KidsDepth)
Search parents and then kids (same as Both
).
KidsThenParents(KidsDepth, ParentsDepth)
Search kids and then parents.
Implementations§
source§impl Search
impl Search
sourcepub fn for_folder(&self, target: &str) -> Result<PathBuf, Error>
pub fn for_folder(&self, target: &str) -> Result<PathBuf, Error>
An easy API method for finding a folder with a given name.
i.e. Search::Kids(u8).for_folder("assets")
sourcepub fn of(self, start: PathBuf) -> SearchFolder
pub fn of(self, start: PathBuf) -> SearchFolder
Use this to search in a specific folder.
This method transforms a Search
into a SearchFolder
, but that detail is mostly
irrelevant. See the example for recommended usage.
Example
use find_folder::Search;
let mut exe_folder = std::env::current_exe().unwrap();
exe_folder.pop(); // Remove the executable's name, leaving the path to the containing folder
let resource_path = Search::KidsThenParents(1, 2).of(exe_folder).for_folder("resources");
Trait Implementations§
source§impl PartialEq for Search
impl PartialEq for Search
impl Copy for Search
impl Eq for Search
impl StructuralEq for Search
impl StructuralPartialEq for Search
Auto Trait Implementations§
impl RefUnwindSafe for Search
impl Send for Search
impl Sync for Search
impl Unpin for Search
impl UnwindSafe for Search
Blanket Implementations§
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