# Struct config::File

source · [−]

    pub struct File<T, F> { /* private fields */ }

Expand description

A configuration source backed up by a file.

It supports optional automatic file format discovery.

## Implementations

source

### impl<F> File<FileSourceString, F> where
F: FileStoredFormat + 'static,

source

#### pub fn from_str(s: &str, format: F) -> Self

source

### impl<F> File<FileSourceFile, F> where
F: FileStoredFormat + 'static,

source

#### pub fn new(name: &str, format: F) -> Self

source

### impl File<FileSourceFile, FileFormat>

source

#### pub fn with_name(name: &str) -> Self

Given the basename of a file, will attempt to locate a file by setting its extension to a registered format.

source

### impl<T, F> File<T, F> where
F: FileStoredFormat + 'static,
T: FileSource<F>,

source

#### pub fn format(self, format: F) -> Self

source

#### pub fn required(self, required: bool) -> Self

## Trait Implementations

source

### impl<T: Clone, F: Clone> Clone for File<T, F>

source

#### fn clone(&self) -> File<T, F>

Returns a copy of the value. Read more

1.0.0 · source

#### fn clone_from(&mut self, source: &Self)

Performs copy-assignment from `source`. Read more

source

### impl<T: Debug, F: Debug> Debug for File<T, F>

source

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

Formats the value using the given formatter. Read more

source

### impl<'a> From<&'a Path> for File<FileSourceFile, FileFormat>

source

#### fn from(path: &'a Path) -> Self

Converts to this type from the input type.

source

### impl From<PathBuf> for File<FileSourceFile, FileFormat>

source

#### fn from(path: PathBuf) -> Self

Converts to this type from the input type.

source

### impl<T, F> Source for File<T, F> where
F: FileStoredFormat + Debug + Clone + Send + Sync + 'static,
T: Sync + Send + FileSource<F> + 'static,

source

#### fn clone_into_box(&self) -> Box<dyn Source + Send + Sync>

source

#### fn collect(&self) -> Result<Map<String, Value>, ConfigError>

Collect all configuration properties available from this source and return a Map. Read more

source

#### fn collect_to(&self, cache: &mut Value) -> Result<(), ConfigError>

Collects all configuration properties to a provided cache.

## Auto Trait Implementations

### impl<T, F> RefUnwindSafe for File<T, F> where
F: RefUnwindSafe,
T: RefUnwindSafe,

### impl<T, F> Send for File<T, F> where
F: Send,
T: Send,

### impl<T, F> Sync for File<T, F> where
F: Sync,
T: Sync,

### impl<T, F> Unpin for File<T, F> where
F: Unpin,
T: Unpin,

### impl<T, F> UnwindSafe for File<T, F> where
F: UnwindSafe,
T: 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,

const: unstable · source

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

source

### impl<T> BorrowMut<T> for T where
T: ?Sized,

const: unstable · source

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

source

### impl<T> From<T> for T

const: unstable · source

#### fn from(t: T) -> T

Returns the argument unchanged.

source

### impl<T, U> Into<U> for T where
U: From<T>,

const: unstable · 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> ToOwned for T where
T: Clone,

#### 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>,

#### type Error = Infallible

The type returned in the event of a conversion error.

const: unstable · source

#### fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.

source

### impl<T, U> TryInto<U> for T where
U: TryFrom<T>,

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

const: unstable · source

#### fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.