Enum find_folder::Search
[−]
[src]
pub enum Search { Parents(ParentsDepth), Kids(KidsDepth), ParentsThenKids(ParentsDepth, KidsDepth), KidsThenParents(KidsDepth, ParentsDepth), }
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.
Methods
impl Search
[src]
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")
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
impl Copy for Search
[src]
impl Clone for Search
[src]
fn clone(&self) -> Search
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Search
[src]
impl PartialEq for Search
[src]
fn eq(&self, __arg_0: &Search) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Search) -> bool
This method tests for !=
.