Clarify 'TempFile' configuration parameters.

This commit is contained in:
Sergio Benitez 2021-03-15 02:43:01 -07:00
parent f9d4a78fbb
commit 1b2edd38b3
3 changed files with 24 additions and 20 deletions

View File

@ -38,16 +38,16 @@ use either::Either;
///
/// # Configuration
///
/// * **temporary file directory**
/// `TempFile` is configured via the following [`config`](crate::config)
/// parameters:
///
/// Configured via the [`temp_dir`](crate::Config::temp_dir) configuration
/// parameter, defaulting to the system's default temporary
/// ([`std::env::temp_dir()`]). Specifies where the files are stored.
/// | Name | Default | Description |
/// |--------------------|---------------------|-----------------------------------------|
/// | `temp_dir` | [`env::temp_dir()`] | Directory files are temporarily stored. |
/// | `limits.file` | 1MiB | Default limit for all file extensions. |
/// | `limits.file/$ext` | _N/A_ | Limit for files with extension `$ext`. |
///
/// * **data limit**
///
/// Controlled via [limits](crate::data::Limits) named `file` and `file/$ext`.
/// When used as a form guard, the extension `ext` is identified by the form
/// When used as a form guard, the extension `$ext` is identified by the form
/// field's `Content-Type` ([`ContentType::extension()`]). When used as a data
/// guard, the extension is identified by the Content-Type of the request, if
/// any. If there is no Content-Type, the limit `file` is used.

View File

@ -61,7 +61,8 @@ use crate::form::prelude::*;
///
/// A value is validated successfully if the `from_str` method for the given
/// type returns successfully. Only accepts form _values_, not binary data.
/// No data limit applies.
///
/// **No type-specific data limit applies.**
///
/// * **`bool`**
///
@ -70,7 +71,7 @@ use crate::form::prelude::*;
/// `"off"`, `"no"`, or `"false"`. Defaults to `false` otherwise. Only
/// accepts form _values_, not binary data.
///
/// **No data limit applies.**
/// **No type-specific data limit applies.**
///
/// * **`&str`, `String`**
///
@ -81,14 +82,16 @@ use crate::form::prelude::*;
///
/// * **[`TempFile`]**
///
/// Streams the form field value or data to a temporary file. See
/// [`TempFile`] for details and data limits.
/// Streams the form field value or data to a temporary file.
///
/// **See [`TempFile`] for details and data limits.**
///
/// * **[`Capped<TempFile>`], [`Capped<String>`], [`Capped<&str>`]**
///
/// Streams the form value or data to the inner value, succeeding even if
/// the data exceeds the respective type limit by truncating the data. See
/// [`Capped`] for details.
/// the data exceeds the respective type limit by truncating the data.
///
/// **See [`Capped`] for details.**
///
/// * **[`time::Date`]**
///
@ -96,7 +99,7 @@ use crate::form::prelude::*;
/// This is the `"date"` HTML input type. Only accepts form _values_, not
/// binary data.
///
/// **No data limit applies.**
/// **No type-specific data limit applies.**
///
/// * **[`time::PrimitiveDateTime`]**
///
@ -105,7 +108,7 @@ use crate::form::prelude::*;
/// without support for the millisecond variant. Only accepts form _values_,
/// not binary data.
///
/// **No data limit applies.**
/// **No type-specific data limit applies.**
///
/// * **[`time::Time`]**
///
@ -113,7 +116,7 @@ use crate::form::prelude::*;
/// This is the `"time"` HTML input type without support for the millisecond
/// variant. Only accepts form _values_, not binary data.
///
/// **No data limit applies.**
/// **No type-specific data limit applies.**
///
/// [`TempFile`]: crate::data::TempFile
///

View File

@ -5,6 +5,7 @@
forms = "64 kB"
json = "1 MiB"
msgpack = "2 MiB"
"file/jpg" = "5 MiB"
[debug]
address = "127.0.0.1"