pub trait ExpectLifecycleExt<This>{
// Required methods
fn expect_reopening<Compile>(
self,
compile: Compile,
) -> impl Future<Output = Result<(), LifecycleError>>
where Compile: FnMut() -> This::Program;
fn expect_answering_what_is_in_flight<Compile>(
self,
compile: Compile,
) -> impl Future<Output = Result<(), LifecycleError>>
where Compile: FnMut() -> This::Program;
fn expect_ending_what_outlives_the_drain<Compile>(
self,
compile: Compile,
) -> impl Future<Output = Result<(), LifecycleError>>
where Compile: FnMut() -> This::Program;
fn measure_closing<Compile>(
self,
compile: Compile,
asking_for: &'static str,
) -> impl Future<Output = Result<Measured, LifecycleError>>
where Compile: FnMut() -> This::Program;
fn expect_closing(
&mut self,
open: &mut This::Open,
) -> impl Future<Output = Result<(), LifecycleError>>;
fn expect_ending(
&mut self,
open: &mut This::Open,
) -> impl Future<Output = Result<(), LifecycleError>>;
fn expect_reopening_while_a_connection_is_held<Compile>(
self,
compile: Compile,
) -> impl Future<Output = Result<(), LifecycleError>>
where Compile: FnMut() -> This::Program;
}Expand description
Holds a concrete server to what opening and closing one bound address must do.
Required Methods§
Sourcefn expect_reopening<Compile>(
self,
compile: Compile,
) -> impl Future<Output = Result<(), LifecycleError>>
fn expect_reopening<Compile>( self, compile: Compile, ) -> impl Future<Output = Result<(), LifecycleError>>
Holds this server to the contract when the connection it served has finished.
One caller asks and is answered, and only then is the server closed. This is the ordinary case: nothing is in flight, so no interpretation has anything to drain.
§Errors
States the first thing the server did not do: an open or close that failed, a close that did not return, or a request the reopened server did not answer.
Sourcefn expect_answering_what_is_in_flight<Compile>(
self,
compile: Compile,
) -> impl Future<Output = Result<(), LifecycleError>>
fn expect_answering_what_is_in_flight<Compile>( self, compile: Compile, ) -> impl Future<Output = Result<(), LifecycleError>>
Holds this server to the contract when the request in flight finishes before the drain.
A caller asks for something taking crate::PAUSE, which is less than any drain an
interpretation states, and the server is closed while that answer is still being produced.
Closing gracefully means this caller is answered rather than cut off, so the answer must
arrive on the connection it was asked on, after the close has already returned.
§Errors
States the first thing the server did not do: an open or close that failed, an answer the closing server never produced, or a request the reopened server did not answer.
Sourcefn expect_ending_what_outlives_the_drain<Compile>(
self,
compile: Compile,
) -> impl Future<Output = Result<(), LifecycleError>>
fn expect_ending_what_outlives_the_drain<Compile>( self, compile: Compile, ) -> impl Future<Output = Result<(), LifecycleError>>
Holds this server to the contract when the request in flight outlives the drain.
The other side of what a bound means. A caller asks for something taking crate::SLOW,
which is longer than any drain, and the server is closed while that answer is still being
produced. Closing gracefully is not closing eventually: what is still being served when the
drain runs out is ended, so this caller must be left without an answer rather than handed
one by a server that no longer exists.
§Errors
States the first thing the server did not do: an open or close that failed, an answer that arrived anyway, or a request the reopened server did not answer.
Sourcefn measure_closing<Compile>(
self,
compile: Compile,
asking_for: &'static str,
) -> impl Future<Output = Result<Measured, LifecycleError>>
fn measure_closing<Compile>( self, compile: Compile, asking_for: &'static str, ) -> impl Future<Output = Result<Measured, LifecycleError>>
Measures what closing and then ending do to one request in flight, rather than stating it.
The same shape as the scenarios above, reporting what it saw instead of holding the server
to it. asking_for chooses which case is measured: /pause for a request that finishes
inside the drain, /slow for one that does not.
Closing and ending are measured in that order on the one server, which is how a caller wanting both would ask: take the address back, then wait for the rest.
§Errors
States an open, close or end that failed. What the request in flight did is measured, never an error, since either outcome is a result worth reporting.
Sourcefn expect_closing(
&mut self,
open: &mut This::Open,
) -> impl Future<Output = Result<(), LifecycleError>>
fn expect_closing( &mut self, open: &mut This::Open, ) -> impl Future<Output = Result<(), LifecycleError>>
Sourcefn expect_ending(
&mut self,
open: &mut This::Open,
) -> impl Future<Output = Result<(), LifecycleError>>
fn expect_ending( &mut self, open: &mut This::Open, ) -> impl Future<Output = Result<(), LifecycleError>>
Sourcefn expect_reopening_while_a_connection_is_held<Compile>(
self,
compile: Compile,
) -> impl Future<Output = Result<(), LifecycleError>>
fn expect_reopening_while_a_connection_is_held<Compile>( self, compile: Compile, ) -> impl Future<Output = Result<(), LifecycleError>>
Holds this server to the contract when a connection is still open as it closes.
A caller connects, is answered, and then asks for something that takes crate::SLOW to
answer, which is longer than any drain an interpretation states. So the connection outlives
the close rather than the close waiting it out: whoever drains hits its own bound and stops
anyway. Closing must still return, and the address must still be free for the server opened
after it.
§Errors
States the first thing the server did not do: an open or close that failed, a close the held connection kept from returning, or a request the reopened server did not answer.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl<This> ExpectLifecycleExt<This> for This
Holds a concrete server to what opening and closing one bound address must do.