pub struct ReadBufferConfig {
pub initial_size: usize,
pub min_size: usize,
pub max_size: usize,
pub growth_factor: f32,
pub shrink_threshold: f32,
pub adaptive: bool,
pub recalculate_interval: usize,
pub content_type_hints: bool,
}Expand description
Configuration for read buffer sizing.
Fields§
§initial_size: usizeInitial buffer size for new connections
min_size: usizeMinimum buffer size
max_size: usizeMaximum buffer size before streaming
growth_factor: f32Growth factor when buffer needs expansion (1.5 = 50% growth)
shrink_threshold: f32Shrink threshold: shrink if usage < capacity * threshold
adaptive: boolEnable adaptive sizing based on traffic patterns
recalculate_interval: usizeHow often to recalculate optimal sizes (requests)
content_type_hints: boolUse content-type hints for sizing
Implementations§
Source§impl ReadBufferConfig
impl ReadBufferConfig
Sourcepub fn high_throughput() -> Self
pub fn high_throughput() -> Self
Create configuration optimized for high throughput.
Sourcepub fn low_memory() -> Self
pub fn low_memory() -> Self
Create configuration optimized for low memory usage.
Sourcepub fn api_server() -> Self
pub fn api_server() -> Self
Create configuration for API servers (typically small JSON).
Sourcepub fn file_upload() -> Self
pub fn file_upload() -> Self
Create configuration for file upload servers.
Sourcepub fn shrink_size(&self, current: usize, used: usize) -> usize
pub fn shrink_size(&self, current: usize, used: usize) -> usize
Calculate buffer size for shrinking.
Sourcepub fn size_for_content_type(&self, content_type: &str) -> usize
pub fn size_for_content_type(&self, content_type: &str) -> usize
Get recommended buffer size for a content type.
Trait Implementations§
Source§impl Clone for ReadBufferConfig
impl Clone for ReadBufferConfig
Source§fn clone(&self) -> ReadBufferConfig
fn clone(&self) -> ReadBufferConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReadBufferConfig
impl Debug for ReadBufferConfig
Auto Trait Implementations§
impl Freeze for ReadBufferConfig
impl RefUnwindSafe for ReadBufferConfig
impl Send for ReadBufferConfig
impl Sync for ReadBufferConfig
impl Unpin for ReadBufferConfig
impl UnwindSafe for ReadBufferConfig
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Injectable for T
impl<T> Injectable for T
Source§fn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Source§fn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging