pub struct FileFinder { /* private fields */ }๐Deprecated since 2.0.1: use cfgmatic-source crate instead, which provides a unified configuration source API
Expand description
Builder for configuring file search.
ยงExample
use cfgmatic_files::FileFinder;
let finder = FileFinder::new("myapp")
.formats(&[cfgmatic_files::Format::Toml, cfgmatic_files::Format::Json])
.base_name("config")
.require_existence(true);Implementationsยง
Sourceยงimpl FileFinder
impl FileFinder
Sourcepub fn new(app_name: impl Into<String>) -> Self
๐Deprecated since 2.0.1: use cfgmatic-source crate instead, which provides a unified configuration source API
pub fn new(app_name: impl Into<String>) -> Self
Create a new file finder for the given application.
Sourcepub fn formats(self, formats: &[Format]) -> Self
๐Deprecated since 2.0.1: use cfgmatic-source crate instead, which provides a unified configuration source API
pub fn formats(self, formats: &[Format]) -> Self
Set the file formats to search for.
Sourcepub fn base_name(self, name: impl Into<String>) -> Self
๐Deprecated since 2.0.1: use cfgmatic-source crate instead, which provides a unified configuration source API
pub fn base_name(self, name: impl Into<String>) -> Self
Set the base name for config files.
For example, if base_name is โappโ, files like โapp.tomlโ, โapp.jsonโ will be searched.
Sourcepub fn any_name(self) -> Self
๐Deprecated since 2.0.1: use cfgmatic-source crate instead, which provides a unified configuration source API
pub fn any_name(self) -> Self
Clear the base name, searching for any file with supported extensions.
Sourcepub const fn require_existence(self, require: bool) -> Self
๐Deprecated since 2.0.1: use cfgmatic-source crate instead, which provides a unified configuration source API
pub const fn require_existence(self, require: bool) -> Self
Require that files exist (default: true).
Sourcepub const fn follow_symlinks(self, follow: bool) -> Self
๐Deprecated since 2.0.1: use cfgmatic-source crate instead, which provides a unified configuration source API
pub const fn follow_symlinks(self, follow: bool) -> Self
Follow symbolic links when searching.
Sourcepub const fn search_depth(self, depth: usize) -> Self
๐Deprecated since 2.0.1: use cfgmatic-source crate instead, which provides a unified configuration source API
pub const fn search_depth(self, depth: usize) -> Self
Set the maximum search depth for directory traversal.
Sourcepub fn build(self) -> FileFinderState
๐Deprecated since 2.0.1: use cfgmatic-source crate instead, which provides a unified configuration source API
pub fn build(self) -> FileFinderState
Build the finder configuration.
Sourcepub fn find(self) -> Result<ConfigFiles>
๐Deprecated since 2.0.1: use cfgmatic-source crate instead, which provides a unified configuration source API
pub fn find(self) -> Result<ConfigFiles>
Find all matching configuration files.
This is a convenience method that builds and searches immediately.
ยงErrors
Returns an error if directories cannot be accessed.
Sourcepub fn find_first(self) -> Result<Option<ConfigFile>>
๐Deprecated since 2.0.1: use cfgmatic-source crate instead, which provides a unified configuration source API
pub fn find_first(self) -> Result<Option<ConfigFile>>
Find the first (highest priority) configuration file.
ยงErrors
Returns an error if directories cannot be accessed.
Trait Implementationsยง
Sourceยงimpl Clone for FileFinder
impl Clone for FileFinder
Sourceยงfn clone(&self) -> FileFinder
fn clone(&self) -> FileFinder
Returns a duplicate of the value. Read more
1.0.0 ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementationsยง
impl Freeze for FileFinder
impl RefUnwindSafe for FileFinder
impl Send for FileFinder
impl Sync for FileFinder
impl Unpin for FileFinder
impl UnsafeUnpin for FileFinder
impl UnwindSafe for FileFinder
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