pub struct CompressionMiddleware { /* private fields */ }Expand description
Compression middleware for reducing message size.
Implementations§
Source§impl CompressionMiddleware
impl CompressionMiddleware
Sourcepub fn new(compression_type: CompressionType, min_size: usize) -> Self
pub fn new(compression_type: CompressionType, min_size: usize) -> Self
Create a new compression middleware.
Trait Implementations§
Source§impl AdvancedMiddleware for CompressionMiddleware
impl AdvancedMiddleware for CompressionMiddleware
Source§fn priority(&self) -> MiddlewarePriority
fn priority(&self) -> MiddlewarePriority
Get middleware priority for execution ordering
Source§fn on_send_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 TransportMessage,
context: &'life2 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_send_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 TransportMessage,
context: &'life2 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called when a message is sent with context.
Source§fn should_execute<'life0, 'life1, 'async_trait>(
&'life0 self,
_context: &'life1 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn should_execute<'life0, 'life1, 'async_trait>(
&'life0 self,
_context: &'life1 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if middleware should be executed for this context
Source§fn on_request_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 mut JSONRPCRequest,
context: &'life2 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_request_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 mut JSONRPCRequest,
context: &'life2 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called before a request is sent with context.
Source§fn on_response_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
response: &'life1 mut JSONRPCResponse,
context: &'life2 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_response_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
response: &'life1 mut JSONRPCResponse,
context: &'life2 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called after a response is received with context.
Source§fn on_receive_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 TransportMessage,
context: &'life2 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_receive_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 TransportMessage,
context: &'life2 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called when a message is received with context.
Source§fn on_notification_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
notification: &'life1 mut JSONRPCNotification,
context: &'life2 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_notification_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
notification: &'life1 mut JSONRPCNotification,
context: &'life2 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called when an unsolicited notification is received with context. Read more
Source§fn on_chain_start<'life0, 'life1, 'async_trait>(
&'life0 self,
_context: &'life1 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_chain_start<'life0, 'life1, 'async_trait>(
&'life0 self,
_context: &'life1 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when middleware chain starts
Source§fn on_chain_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
_context: &'life1 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_chain_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
_context: &'life1 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when middleware chain completes
Source§fn on_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_error: &'life1 Error,
_context: &'life2 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_error: &'life1 Error,
_context: &'life2 MiddlewareContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called when an error occurs in the chain
Auto Trait Implementations§
impl Freeze for CompressionMiddleware
impl RefUnwindSafe for CompressionMiddleware
impl Send for CompressionMiddleware
impl Sync for CompressionMiddleware
impl Unpin for CompressionMiddleware
impl UnsafeUnpin for CompressionMiddleware
impl UnwindSafe for CompressionMiddleware
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