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,19 +38,19 @@ use either::Either;
/// ///
/// # Configuration /// # Configuration
/// ///
/// * **temporary file directory** /// `TempFile` is configured via the following [`config`](crate::config)
/// parameters:
/// ///
/// Configured via the [`temp_dir`](crate::Config::temp_dir) configuration /// | Name | Default | Description |
/// parameter, defaulting to the system's default temporary /// |--------------------|---------------------|-----------------------------------------|
/// ([`std::env::temp_dir()`]). Specifies where the files are stored. /// | `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** /// 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
/// Controlled via [limits](crate::data::Limits) named `file` and `file/$ext`. /// guard, the extension is identified by the Content-Type of the request, if
/// When used as a form guard, the extension `ext` is identified by the form /// any. If there is no Content-Type, the limit `file` is used.
/// 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.
/// ///
/// # Cappable /// # Cappable
/// ///

View File

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

View File

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