#[non_exhaustive]pub struct S3Config {
pub xml_max_body_size: usize,
pub post_object_max_file_size: u64,
pub form_max_field_size: usize,
pub form_max_fields_size: usize,
pub form_max_parts: usize,
pub presigned_url_max_skew_time_secs: u32,
pub normalize_forward_slash_path: bool,
}Expand description
S3 Service Configuration.
Contains configurable parameters for the S3 service with sensible defaults. The configuration is immutable after creation.
Use with StaticConfigProvider or HotReloadConfigProvider.
§Example
use std::sync::Arc;
use s3s::config::{S3Config, S3ConfigProvider, StaticConfigProvider, HotReloadConfigProvider};
let mut config = S3Config::default();
config.xml_max_body_size = 10 * 1024 * 1024;
// Wrap in StaticConfigProvider for immutable config
let static_provider = Arc::new(StaticConfigProvider::new(Arc::new(config.clone())));
let snapshot = static_provider.snapshot();
assert_eq!(snapshot.xml_max_body_size, 10 * 1024 * 1024);
// Or wrap in HotReloadConfigProvider for runtime updates
let hot_config = Arc::new(HotReloadConfigProvider::new(Arc::new(config)));
let snapshot = hot_config.snapshot();
assert_eq!(snapshot.xml_max_body_size, 10 * 1024 * 1024);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.xml_max_body_size: usizeMaximum size for XML body payloads in bytes.
This limit prevents unbounded memory allocation for operations that require the full body in memory (e.g., XML parsing).
Default: 20 MB (20 * 1024 * 1024)
post_object_max_file_size: u64Maximum file size for POST object in bytes.
S3 has a 5GB limit for single PUT object, so this is a reasonable default.
Default: 5 GB (5 * 1024 * 1024 * 1024)
form_max_field_size: usizeMaximum size per form field in bytes.
This prevents denial-of-service attacks via oversized individual fields.
Default: 1 MB (1024 * 1024)
form_max_fields_size: usizeMaximum total size for all form fields combined in bytes.
This prevents denial-of-service attacks via accumulation of many fields.
Default: 20 MB (20 * 1024 * 1024)
form_max_parts: usizeMaximum number of parts in multipart form.
This prevents denial-of-service attacks via excessive part count.
Default: 1000
presigned_url_max_skew_time_secs: u32Maximum allowed time skew for presigned URLs in seconds.
This allows requests that are up to this many seconds in the future to account for clock skew between the client and server.
Default: 900 (15 minutes)
normalize_forward_slash_path: boolWhether to normalize forward slashes in object keys.
If enabled, multiple consecutive slashes will be treated as a single slash:
- If the path does not start with
/, no normalization is performed. - If the path starts with
/, normalization:- removes all leading slashes (unless the entire path is one or more
/) - replaces consecutive internal slashes with a single slash
- reduces one or more trailing slashes to a single trailing slash
- removes all leading slashes (unless the entire path is one or more
- Examples:
- “/” -> “/”
- “/keyname” -> “keyname”
- “//keyname” -> “keyname”
- “//keyname/” -> “keyname/”
- “//dir////keyname” -> “dir/keyname”
- “dir///sub//file” -> “dir///sub//file”
- “/dir///sub//file” -> “dir/sub/file”
Default: false
Trait Implementations§
Source§impl<'de> Deserialize<'de> for S3Config
impl<'de> Deserialize<'de> for S3Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for S3Config
impl StructuralPartialEq for S3Config
Auto Trait Implementations§
impl Freeze for S3Config
impl RefUnwindSafe for S3Config
impl Send for S3Config
impl Sync for S3Config
impl Unpin for S3Config
impl UnsafeUnpin for S3Config
impl UnwindSafe for S3Config
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.