pub struct LayerConfig {
pub body_limit: usize,
pub buffer_size: usize,
pub concurrency: usize,
pub handling_timeout: Duration,
pub default_fallback: bool,
}Expand description
A configuration object for Axum / Tower middleware.
Defaults:
assert_eq!(
LayerConfig::default(),
LayerConfig {
body_limit: 16384,
buffer_size: 4096,
concurrency: 4096,
handling_timeout: Duration::from_secs(25),
default_fallback: true,
}
);Fields§
§body_limit: usizeThe maximum size of the request body in bytes. Helps prevent DoS, but may need to be increased for some services.
buffer_size: usizeThe size of the work buffer for our service. Allows the server to immediately work on more queued requests when a request completes, and prevents a large backlog from building up.
concurrency: usizeThe maximum # of requests we’ll process at once. Helps prevent the CPU from maxing out, resulting in thrashing.
handling_timeout: DurationThe maximum time a server can spend handling a request. Helps prevent degenerate cases which take abnormally long to process from crowding out normal workloads.
default_fallback: boolWhether to add Lexe’s default Router::fallback to the Router.
The Router::fallback is called if no routes were matched;
Lexe’s default_fallback returns a “bad endpoint” rejection along
with the requested method and path.
If you need to set a custom fallback, set this to false, otherwise
your custom fallback will be clobbered by Lexe’s default_fallback.
NOTE, however, that the caller is responsible for ensuring that the
Router has a fallback configured in this case.
Trait Implementations§
Source§impl Clone for LayerConfig
impl Clone for LayerConfig
Source§fn clone(&self) -> LayerConfig
fn clone(&self) -> LayerConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LayerConfig
impl Debug for LayerConfig
Source§impl Default for LayerConfig
impl Default for LayerConfig
Source§impl PartialEq for LayerConfig
impl PartialEq for LayerConfig
impl Eq for LayerConfig
impl StructuralPartialEq for LayerConfig
Auto Trait Implementations§
impl Freeze for LayerConfig
impl RefUnwindSafe for LayerConfig
impl Send for LayerConfig
impl Sync for LayerConfig
impl Unpin for LayerConfig
impl UnsafeUnpin for LayerConfig
impl UnwindSafe for LayerConfig
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,
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§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.