pub struct Http1Zerocopy<Io> { /* private fields */ }Available on Linux and crate feature
h1-zerocopy only.Expand description
An HTTP/1.x connection handler that uses emulated sendfile for zero-copy response body transmission on Linux.
Obtain an instance via Http1::zerocopy. When a response has a
ZerocopyResponse extension installed (see install_zerocopy), the
handler will use emulated sendfile (utilizing the Linux splice(2) syscall
and Unix pipes) to stream the file from the kernel page cache
to the socket, bypassing user-space copies.
For responses without that extension the behaviour is identical to the
regular Http1 handler.
Only available on Linux (target_os = "linux").
Trait Implementations§
Source§impl<Io> HttpProtocol for Http1Zerocopy<Io>
Available on crate feature h1 only.
impl<Io> HttpProtocol for Http1Zerocopy<Io>
Available on crate feature
h1 only.fn handle_with_error_fn<F, Fut, ResB, ResBE, ResE, EF, EFut, EResB, EResBE, EResE>(
self,
request_fn: F,
error_fn: EF,
) -> impl Future<Output = Result<(), Error>>where
F: Fn(Request<Incoming>) -> Fut + 'static,
Fut: Future<Output = Result<Response<ResB>, ResE>> + 'static,
ResB: Body<Data = Bytes, Error = ResBE> + Unpin + 'static,
ResE: Error,
ResBE: Error,
EF: FnOnce(bool) -> EFut,
EFut: Future<Output = Result<Response<EResB>, EResE>>,
EResB: Body<Data = Bytes, Error = EResBE> + Unpin + 'static,
EResE: Error,
EResBE: Error,
fn handle<F, Fut, ResB, ResBE, ResE>( self, request_fn: F, ) -> impl Future<Output = Result<(), Error>>
Auto Trait Implementations§
impl<Io> Freeze for Http1Zerocopy<Io>where
Io: Freeze,
impl<Io> RefUnwindSafe for Http1Zerocopy<Io>where
Io: RefUnwindSafe,
impl<Io> Send for Http1Zerocopy<Io>where
Io: Send,
impl<Io> Sync for Http1Zerocopy<Io>where
Io: Sync,
impl<Io> Unpin for Http1Zerocopy<Io>where
Io: Unpin,
impl<Io> UnsafeUnpin for Http1Zerocopy<Io>where
Io: UnsafeUnpin,
impl<Io> UnwindSafe for Http1Zerocopy<Io>where
Io: UnwindSafe,
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