builder
This commit is contained in:
parent
2cee0af3d2
commit
870ccd9084
|
|
@ -89,8 +89,14 @@ pub struct HttpsLayer {
|
||||||
|
|
||||||
/// Settings for [`HttpsLayer`]
|
/// Settings for [`HttpsLayer`]
|
||||||
pub struct HttpsLayerSettings {
|
pub struct HttpsLayerSettings {
|
||||||
/// Maximum number of sessions to cache. Session capacity is per session key (domain).
|
session_cache_capacity: usize,
|
||||||
pub session_cache_capacity: usize,
|
}
|
||||||
|
|
||||||
|
impl HttpsLayerSettings {
|
||||||
|
/// Constructs an [`HttpsLayerSettingsBuilder`] for configuring settings
|
||||||
|
pub fn builder() -> HttpsLayerSettingsBuilder {
|
||||||
|
HttpsLayerSettingsBuilder(HttpsLayerSettings::default())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for HttpsLayerSettings {
|
impl Default for HttpsLayerSettings {
|
||||||
|
|
@ -101,6 +107,22 @@ impl Default for HttpsLayerSettings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Builder for [`HttpsLayerSettings`]
|
||||||
|
pub struct HttpsLayerSettingsBuilder(HttpsLayerSettings);
|
||||||
|
|
||||||
|
impl HttpsLayerSettingsBuilder {
|
||||||
|
/// Sets maximum number of sessions to cache. Session capacity is per session key (domain).
|
||||||
|
/// Defaults to 8.
|
||||||
|
pub fn set_session_cache_capacity(&mut self, capacity: usize) {
|
||||||
|
self.0.session_cache_capacity = capacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Consumes the builder, returning a new [`HttpsLayerSettings`]
|
||||||
|
pub fn build(self) -> HttpsLayerSettings {
|
||||||
|
self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl HttpsLayer {
|
impl HttpsLayer {
|
||||||
/// Creates a new `HttpsLayer` with default settings.
|
/// Creates a new `HttpsLayer` with default settings.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue