Struct zebra_test::mock_service::MockService
source · pub struct MockService<Request, Response, Assertion, Error = BoxError> {
receiver: Receiver<Arc<Mutex<Option<ResponseSender<Request, Response, Error>>>>>,
sender: Sender<Arc<Mutex<Option<ResponseSender<Request, Response, Error>>>>>,
poll_count: Arc<AtomicUsize>,
max_request_delay: Duration,
_assertion_type: PhantomData<Assertion>,
}
Expand description
A service implementation that allows intercepting requests for checking them.
The type is generic over the request and response types, and also has an extra generic type
parameter that’s used as a tag to determine if the internal assertions should panic or return
errors for proptest minimization. See AssertionType
for more information.
The mock service can be cloned, and provides methods for checking the received requests as well as responding to them individually.
Internally, the instance that’s operating as the service will forward requests to a
[broadcast
] channel that the other instances listen to.
See the module-level documentation for an example.
Fields§
§receiver: Receiver<Arc<Mutex<Option<ResponseSender<Request, Response, Error>>>>>
§sender: Sender<Arc<Mutex<Option<ResponseSender<Request, Response, Error>>>>>
§poll_count: Arc<AtomicUsize>
§max_request_delay: Duration
§_assertion_type: PhantomData<Assertion>
Implementations§
source§impl MockService<(), (), ()>
impl MockService<(), (), ()>
An entry point for starting the MockServiceBuilder
.
This impl
block exists for ergonomic reasons. The generic type parameters don’t matter,
because they are actually set by MockServiceBuilder::finish
.
sourcepub fn build() -> MockServiceBuilder
pub fn build() -> MockServiceBuilder
Create a MockServiceBuilder
to help with the creation of a MockService
.
source§impl<Request, Response, Error> MockService<Request, Response, PanicAssertion, Error>
impl<Request, Response, Error> MockService<Request, Response, PanicAssertion, Error>
Implementation of MockService
methods that use standard Rust panicking assertions.
sourcepub async fn expect_request(
&mut self,
expected: Request,
) -> ResponseSender<Request, Response, Error>
pub async fn expect_request( &mut self, expected: Request, ) -> ResponseSender<Request, Response, Error>
Expect a specific request to be received.
The expected request should be the next one in the internal queue, or if the queue is
empty, it should be received in at most the max delay time configured by
MockServiceBuilder::with_max_request_delay
.
If the received request matches the expected request, a ResponseSender
is returned
which can be used to inspect the request and respond to it. If no response is sent, the
sender of the requests receives an error.
§Panics
If no request is received or if a request is received that’s not equal to the expected request, this method panics.
§Example
let call = tokio::spawn(mock_service.clone().oneshot("request"));
mock_service.expect_request("request").await.respond("response");
assert!(matches!(call.await, Ok(Ok("response"))));
sourcepub async fn expect_request_that(
&mut self,
condition: impl FnOnce(&Request) -> bool,
) -> ResponseSender<Request, Response, Error>where
Request: Debug,
pub async fn expect_request_that(
&mut self,
condition: impl FnOnce(&Request) -> bool,
) -> ResponseSender<Request, Response, Error>where
Request: Debug,
Expect a request to be received that matches a specified condition.
There should be a request already in the internal queue, or a request should be received in
at most the max delay time configured by MockServiceBuilder::with_max_request_delay
.
The received request is passed to the condition
function, which should return true
if
it matches the expected condition or false
otherwise. If true
is returned, a
ResponseSender
is returned which can be used to inspect the request again and respond
to it. If no response is sent, the sender of the requests receives an error.
§Panics
If the condition
function returns false
, this method panics.
§Example
let call = tokio::spawn(mock_service.clone().oneshot(1));
mock_service.expect_request_that(|request| *request > 0).await.respond("response");
assert!(matches!(call.await, Ok(Ok("response"))));
sourcepub async fn expect_no_requests(&mut self)where
Request: Debug,
pub async fn expect_no_requests(&mut self)where
Request: Debug,
Expect no requests to be received.
The internal queue of received requests should be empty, and no new requests should arrive
for the max delay time configured by MockServiceBuilder::with_max_request_delay
.
§Panics
If the queue is not empty or if a request is received before the max request delay timeout expires.
§Example
mock_service.expect_no_requests().await;
sourceasync fn next_request(&mut self) -> ResponseSender<Request, Response, Error>
async fn next_request(&mut self) -> ResponseSender<Request, Response, Error>
Returns the next request from the queue, or panics if there are no requests after a short timeout.
Returns the next request in the internal queue or waits at most the max delay time
configured by MockServiceBuilder::with_max_request_delay
for a new request to be
received, and then returns that.
§Panics
If the queue is empty and a request is not received before the max request delay timeout expires.
sourcepub fn poll_count(&self) -> usize
pub fn poll_count(&self) -> usize
Returns a count of the number of times this service has been polled.
Note: The poll count wraps around on overflow.
source§impl<Request, Response, Error> MockService<Request, Response, PropTestAssertion, Error>
impl<Request, Response, Error> MockService<Request, Response, PropTestAssertion, Error>
Implementation of MockService
methods that use [mod@proptest
] assertions.
sourcepub async fn expect_request(
&mut self,
expected: Request,
) -> Result<ResponseSender<Request, Response, Error>, TestCaseError>
pub async fn expect_request( &mut self, expected: Request, ) -> Result<ResponseSender<Request, Response, Error>, TestCaseError>
Expect a specific request to be received.
The expected request should be the next one in the internal queue, or if the queue is
empty, it should be received in at most the max delay time configured by
MockServiceBuilder::with_max_request_delay
.
If the received request matches the expected request, a ResponseSender
is returned
which can be used to inspect the request and respond to it. If no response is sent, the
sender of the requests receives an error.
If no request is received or if a request is received that’s not equal to the expected
request, this method returns an error generated by a [mod@proptest
] assertion.
§Example
let call = tokio::spawn(mock_service.clone().oneshot("request"));
// NOTE: The try operator `?` is required for errors to be handled by proptest.
mock_service
.expect_request("request").await?
.respond("response");
prop_assert!(matches!(call.await, Ok(Ok("response"))));
sourcepub async fn expect_request_that(
&mut self,
condition: impl FnOnce(&Request) -> bool,
) -> Result<ResponseSender<Request, Response, Error>, TestCaseError>where
Request: Debug,
pub async fn expect_request_that(
&mut self,
condition: impl FnOnce(&Request) -> bool,
) -> Result<ResponseSender<Request, Response, Error>, TestCaseError>where
Request: Debug,
Expect a request to be received that matches a specified condition.
There should be a request already in the internal queue, or a request should be received in
at most the max delay time configured by MockServiceBuilder::with_max_request_delay
.
The received request is passed to the condition
function, which should return true
if
it matches the expected condition or false
otherwise. If true
is returned, a
ResponseSender
is returned which can be used to inspect the request again and respond
to it. If no response is sent, the sender of the requests receives an error.
If the condition
function returns false
, this method returns an error generated by a
[mod@proptest
] assertion.
§Example
let call = tokio::spawn(mock_service.clone().oneshot(1));
// NOTE: The try operator `?` is required for errors to be handled by proptest.
mock_service
.expect_request_that(|request| *request > 0).await?
.respond("OK");
prop_assert!(matches!(call.await, Ok(Ok("OK"))));
sourcepub async fn expect_no_requests(&mut self) -> Result<(), TestCaseError>where
Request: Debug,
pub async fn expect_no_requests(&mut self) -> Result<(), TestCaseError>where
Request: Debug,
Expect no requests to be received.
The internal queue of received requests should be empty, and no new requests should arrive
for the max delay time configured by MockServiceBuilder::with_max_request_delay
.
If the queue is not empty or if a request is received before the max request delay timeout
expires, an error generated by a [mod@proptest
] assertion is returned.
§Example
// NOTE: The try operator `?` is required for errors to be handled by proptest.
mock_service.expect_no_requests().await?;
sourceasync fn next_request(
&mut self,
) -> Result<ResponseSender<Request, Response, Error>, TestCaseError>
async fn next_request( &mut self, ) -> Result<ResponseSender<Request, Response, Error>, TestCaseError>
A helper method to get the next request from the queue.
Returns the next request in the internal queue or waits at most the max delay time
configured by MockServiceBuilder::with_max_request_delay
for a new request to be
received, and then returns that.
If the queue is empty and a request is not received before the max request delay timeout
expires, an error generated by a [mod@proptest
] assertion is returned.
sourcepub fn poll_count(&self) -> usize
pub fn poll_count(&self) -> usize
Returns a count of the number of times this service has been polled.
Note: The poll count wraps around on overflow.
source§impl<Request, Response, Assertion, Error> MockService<Request, Response, Assertion, Error>
impl<Request, Response, Assertion, Error> MockService<Request, Response, Assertion, Error>
Code that is independent of the assertions used in MockService
.
sourcepub async fn try_next_request(
&mut self,
) -> Option<ResponseSender<Request, Response, Error>>
pub async fn try_next_request( &mut self, ) -> Option<ResponseSender<Request, Response, Error>>
Try to get the next request received.
Returns the next element in the queue. If the queue is empty, waits at most the max request
delay configured by MockServiceBuilder::with_max_request_delay
for a request, and
returns it.
If no request is received, returns None
.
If too many requests are received and the queue fills up, the oldest requests are dropped
and ignored. This means that calling this may not receive the next request if the queue is
not dimensioned properly with the MockServiceBuilder::with_proxy_channel_size
method.
Trait Implementations§
source§impl<Request, Response, Assertion, Error> Clone for MockService<Request, Response, Assertion, Error>
impl<Request, Response, Assertion, Error> Clone for MockService<Request, Response, Assertion, Error>
source§fn clone(&self) -> Self
fn clone(&self) -> Self
Clones the MockService
.
This is a cheap operation, because it simply clones the [broadcast
] channel endpoints.
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<Request, Response, Assertion, Error> Service<Request> for MockService<Request, Response, Assertion, Error>
impl<Request, Response, Assertion, Error> Service<Request> for MockService<Request, Response, Assertion, Error>
The [tower::Service
] implementation of the MockService
.
The MockService
is always ready, and it intercepts the requests wrapping them in a
ResponseSender
which can be used to send a response.
source§type Future = Pin<Box<dyn Future<Output = Result<<MockService<Request, Response, Assertion, Error> as Service<Request>>::Response, <MockService<Request, Response, Assertion, Error> as Service<Request>>::Error>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<<MockService<Request, Response, Assertion, Error> as Service<Request>>::Response, <MockService<Request, Response, Assertion, Error> as Service<Request>>::Error>> + Send>>
Auto Trait Implementations§
impl<Request, Response, Assertion, Error> Freeze for MockService<Request, Response, Assertion, Error>
impl<Request, Response, Assertion, Error = Box<dyn Error + Sync + Send>> !RefUnwindSafe for MockService<Request, Response, Assertion, Error>
impl<Request, Response, Assertion, Error> Send for MockService<Request, Response, Assertion, Error>
impl<Request, Response, Assertion, Error> Sync for MockService<Request, Response, Assertion, Error>
impl<Request, Response, Assertion, Error> Unpin for MockService<Request, Response, Assertion, Error>where
Assertion: Unpin,
impl<Request, Response, Assertion, Error = Box<dyn Error + Sync + Send>> !UnwindSafe for MockService<Request, Response, Assertion, Error>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<S, Request> IsReady<Request> for Swhere
S: Service<Request> + Send,
Request: 'static,
impl<S, Request> IsReady<Request> for Swhere
S: Service<Request> + Send,
Request: 'static,
source§fn is_ready(&mut self) -> Pin<Box<dyn Future<Output = bool> + Send + '_>>
fn is_ready(&mut self) -> Pin<Box<dyn Future<Output = bool> + Send + '_>>
Service
] once, and return true if it is immediately ready to be called.§impl<M, S, Target, Request> MakeService<Target, Request> for Mwhere
M: Service<Target, Response = S>,
S: Service<Request>,
impl<M, S, Target, Request> MakeService<Target, Request> for Mwhere
M: Service<Target, Response = S>,
S: Service<Request>,
§fn poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
fn poll_ready( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
Poll::Ready
when the factory is able to create more services. Read more§fn make_service(
&mut self,
target: Target,
) -> <M as MakeService<Target, Request>>::Future
fn make_service( &mut self, target: Target, ) -> <M as MakeService<Target, Request>>::Future
§fn into_service(self) -> IntoService<Self, Request>where
Self: Sized,
fn into_service(self) -> IntoService<Self, Request>where
Self: Sized,
§fn as_service(&mut self) -> AsService<'_, Self, Request>where
Self: Sized,
fn as_service(&mut self) -> AsService<'_, Self, Request>where
Self: Sized,
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
] or
a color-specific method, such as [OwoColorize::green
], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
] or
a color-specific method, such as [OwoColorize::on_yellow
], Read more§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
source§impl<Response, Error> ResponseResult<Response, Error> for Response
impl<Response, Error> ResponseResult<Response, Error> for Response
source§fn into_result(self) -> Result<Response, Error>
fn into_result(self) -> Result<Response, Error>
Result
that can be sent as a response.§impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
§fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
§fn ready_and(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready_and(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
ServiceExt::ready
method instead§fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
§fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
Service
, calling with the providing request once it is ready.§fn and_then<F>(self, f: F) -> AndThen<Self, F>
fn and_then<F>(self, f: F) -> AndThen<Self, F>
poll_ready
method. Read more§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
poll_ready
method. Read more§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
poll_ready
method. Read more§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
Result<Self::Response, Self::Error>
)
to a different value, regardless of whether the future succeeds or
fails. Read more§fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
§fn filter<F, NewRequest>(self, filter: F) -> Filter<Self, F>where
Self: Sized,
F: Predicate<NewRequest>,
fn filter<F, NewRequest>(self, filter: F) -> Filter<Self, F>where
Self: Sized,
F: Predicate<NewRequest>,
§fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where
Self: Sized,
F: AsyncPredicate<NewRequest>,
fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where
Self: Sized,
F: AsyncPredicate<NewRequest>,
AsyncFilter
that conditionally accepts or
rejects requests based on an [async predicate]. Read more