Expand description
Configuration for Automorph behavior. Configuration for Automorph behavior.
This module provides configuration options that can be set globally or per-thread.
§Collection Size Limits
By default, Automorph limits collections to DEFAULT_MAX_COLLECTION_SIZE (10 million)
elements to prevent memory exhaustion from malicious documents.
You can override this limit globally or for a specific scope:
use automorph::config;
// Set a global limit (affects all threads until changed)
config::set_max_collection_size(1_000_000);
// Or use a scoped limit that automatically restores the previous value
config::with_max_collection_size(100, || {
// Within this closure, max collection size is 100
// After the closure returns, the previous limit is restored
});Constants§
- DEFAULT_
MAX_ COLLECTION_ SIZE - Default maximum number of elements allowed when loading collections. This prevents memory exhaustion from malicious documents that claim to have billions of elements.
Functions§
- max_
collection_ size - Gets the current maximum collection size limit.
- set_
max_ collection_ size - Sets the maximum collection size limit for the current thread.
- with_
max_ collection_ size - Executes a closure with a temporary collection size limit.