pub struct CollectionBuilder(/* private fields */);
Expand description
A builder of Collection
. See Collection::builder()
.
Implementations§
source§impl CollectionBuilder
impl CollectionBuilder
sourcepub fn insert(self, host: Host) -> Self
pub fn insert(self, host: Host) -> Self
Adds host
to the builder.
This will match the host
header and SNI hostname for [Host.name
].
If it is the first call to this function, Self::set_pre_host_limiter
is called
with Host::limiter
.
sourcepub fn default(self, host: Host) -> Self
pub fn default(self, host: Host) -> Self
Adds a default host
which is the fallback for all requests with a requested host
which does not match any host added using Self::insert
.
This is not needed when debugging, as the first
Host
to be inserted is used for requests tolocalhost
.
NOTE: This should be used with care as all secure connections to this server
with a SNI hostname that is not registered in this Collection
, the client will get
a security warning, as the certificate of the default host is used.
This is fine with HTTP, as that only delivers the website.
§Panics
Panics if this function is called twice on the same struct. You should only set the default once.
sourcepub fn set_pre_host_limiter(self, limiter: LimitManager) -> Self
pub fn set_pre_host_limiter(self, limiter: LimitManager) -> Self
Sets the limiter used before any data is read. Only when the LimitManager
returns
LimitAction::Drop
will this do anything here.
sourcepub fn build(self) -> Arc<Collection>
pub fn build(self) -> Arc<Collection>
Puts the inner Collection
in a Arc
and returns it.
This works great with the overall flow of Kvarn. See RunConfig::execute()
for an example.
sourcepub fn into_inner(self) -> Collection
pub fn into_inner(self) -> Collection
Converts self
to a Collection
.