mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-12 22:10:01 -04:00
refactor protocol extensions
This commit is contained in:
parent
1ae3986a82
commit
36fddc8943
10 changed files with 289 additions and 190 deletions
|
@ -124,11 +124,10 @@ where
|
|||
}
|
||||
|
||||
type WispV2ClosureResult = Pin<Box<dyn Future<Output = Result<(), WispError>> + Sync + Send>>;
|
||||
type WispV2ClosureBuilders<'a> = &'a mut [AnyProtocolExtensionBuilder];
|
||||
/// Wisp V2 handshake and protocol extension settings wrapper struct.
|
||||
pub struct WispV2Extensions {
|
||||
builders: Vec<AnyProtocolExtensionBuilder>,
|
||||
closure: Box<dyn Fn(WispV2ClosureBuilders) -> WispV2ClosureResult + Send>,
|
||||
closure: Box<dyn Fn(&mut Vec<AnyProtocolExtensionBuilder>) -> WispV2ClosureResult + Send>,
|
||||
}
|
||||
|
||||
impl WispV2Extensions {
|
||||
|
@ -143,7 +142,7 @@ impl WispV2Extensions {
|
|||
/// Create a Wisp V2 settings struct with some middleware.
|
||||
pub fn new_with_middleware<C>(builders: Vec<AnyProtocolExtensionBuilder>, closure: C) -> Self
|
||||
where
|
||||
C: Fn(WispV2ClosureBuilders) -> WispV2ClosureResult + Send + 'static,
|
||||
C: Fn(&mut Vec<AnyProtocolExtensionBuilder>) -> WispV2ClosureResult + Send + 'static,
|
||||
{
|
||||
Self {
|
||||
builders,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue