pub struct TCPClient { /* private fields */ }clients or servers) and crate feature clients only.Expand description
A generic TCP client that can handle connections to multiple TCP Servers.
This client allows for connecting to many servers all at once, or creating a real “TCP Server” that allows people to connect to it (for SDIO). Because of the weirdness of our SDIO client, and the hooks for scientists this client ends up accepting a lot of parameters, see the module documentation for more information.
Implementations§
Source§impl TCPClient
impl TCPClient
Sourcepub fn new(
service_name: &'static str,
guard: impl Into<NagleGuard>,
nagle_hooks: (Option<&'static dyn PreNagleFnTy>, Option<&'static dyn PostNagleFnTy>),
trace_io_during_debug: bool,
) -> Self
pub fn new( service_name: &'static str, guard: impl Into<NagleGuard>, nagle_hooks: (Option<&'static dyn PreNagleFnTy>, Option<&'static dyn PostNagleFnTy>), trace_io_during_debug: bool, ) -> Self
Construct a new TCP Client.
This TCP client will by default not connect to anything/listen to any
ports. Instead you will have to call TCPClient::connect, and
TCPClient::bind manually to setup connections.
Remember the default TCPClient::send, and TCPClient::receive will
only return responses to the “primary” connection (whichever connection
has the oldest connection). That is unless you call
TCPClient::set_primary_stream.
Sourcepub const fn set_cat_dev_slowdown(&mut self, slowdown: Option<Duration>)
pub const fn set_cat_dev_slowdown(&mut self, slowdown: Option<Duration>)
Set the slowdown to before sending bytes from this server.
Sourcepub const fn should_keep_all_responses(&mut self)
pub const fn should_keep_all_responses(&mut self)
Mark that this client should keep all responses (e.g. those from the non active upstreams).
Sourcepub const fn set_keep_all_responses(&mut self, keep: bool)
pub const fn set_keep_all_responses(&mut self, keep: bool)
Set directly whether or not this client should keep all responses.
Sourcepub fn set_primary_stream(&mut self, stream_id: u64)
pub fn set_primary_stream(&mut self, stream_id: u64)
Set the primary stream to receive responses from.
pub const fn chunk_output_at_size(&self) -> Option<usize>
pub const fn set_chunk_output_at_size(&mut self, new_size: Option<usize>)
pub const fn slowloris_timeout(&self) -> Duration
pub const fn set_slowloris_timeout(&mut self, slowloris_timeout: Duration)
pub const fn on_stream_begin( &self, ) -> Option<&UnderlyingOnStreamBeginService<()>>
Sourcepub fn set_raw_on_stream_begin(
&mut self,
on_start: Option<UnderlyingOnStreamBeginService<()>>,
) -> Result<(), CommonNetAPIError>
pub fn set_raw_on_stream_begin( &mut self, on_start: Option<UnderlyingOnStreamBeginService<()>>, ) -> Result<(), CommonNetAPIError>
Set a hook to run when a stream has been created.
This is what happens when a new machine connects. So it may also be
refered to as “on connect”. This assumes you’re assigning a service
that already exists and is in the raw storage type, you may want to
look into Self::set_on_stream_begin, or
Self::set_on_stream_begin_service.
§Errors
If the stream beginning hook has already been registered. If you’re looking to perform multiple actions at once, look into layer-ing.
Sourcepub fn set_on_stream_begin<HandlerTy, HandlerParamsTy>(
&mut self,
handler: HandlerTy,
) -> Result<(), CommonNetAPIError>where
HandlerParamsTy: Send + 'static,
HandlerTy: OnRequestStreamBeginHandler<HandlerParamsTy, ()> + Clone + Send + 'static,
pub fn set_on_stream_begin<HandlerTy, HandlerParamsTy>(
&mut self,
handler: HandlerTy,
) -> Result<(), CommonNetAPIError>where
HandlerParamsTy: Send + 'static,
HandlerTy: OnRequestStreamBeginHandler<HandlerParamsTy, ()> + Clone + Send + 'static,
Set a function hook to run when a stream has been created.
This is what happens when a new machine connects. So it may also be
refered to as “on connect”. This assumes you’re assigning a function
to on stream begin otherwise use Self::set_raw_on_stream_begin,
or Self::set_on_stream_begin_service.
§Errors
If the stream beginning hook has already been registered. If you’re looking to perform multiple actions at once, look into layer-ing.
Sourcepub fn set_on_stream_begin_service<ServiceTy>(
&mut self,
service_ty: ServiceTy,
) -> Result<(), CommonNetAPIError>where
ServiceTy: Clone + Send + Service<RequestStreamEvent<()>, Response = bool, Error = CatBridgeError> + 'static,
ServiceTy::Future: Send + 'static,
pub fn set_on_stream_begin_service<ServiceTy>(
&mut self,
service_ty: ServiceTy,
) -> Result<(), CommonNetAPIError>where
ServiceTy: Clone + Send + Service<RequestStreamEvent<()>, Response = bool, Error = CatBridgeError> + 'static,
ServiceTy::Future: Send + 'static,
Set a function hook to run when a stream has been created.
This is what happens when a new machine connects. So it may also be
refered to as “on connect”. This assumes you’re assigning a Service
to on stream begin otherwise use Self::set_raw_on_stream_begin,
or Self::set_on_stream_begin.
§Errors
If the stream beginning hook has already been registered. If you’re looking to perform multiple actions at once, look into layer-ing.
Sourcepub fn layer_on_stream_begin<LayerTy, ServiceTy>(
&mut self,
layer: LayerTy,
) -> Result<(), CommonNetAPIError>where
LayerTy: Layer<UnderlyingOnStreamBeginService<()>, Service = ServiceTy>,
ServiceTy: Service<RequestStreamEvent<()>, Response = bool, Error = CatBridgeError> + Clone + Send + 'static,
<LayerTy::Service as Service<RequestStreamEvent<()>>>::Future: Send + 'static,
pub fn layer_on_stream_begin<LayerTy, ServiceTy>(
&mut self,
layer: LayerTy,
) -> Result<(), CommonNetAPIError>where
LayerTy: Layer<UnderlyingOnStreamBeginService<()>, Service = ServiceTy>,
ServiceTy: Service<RequestStreamEvent<()>, Response = bool, Error = CatBridgeError> + Clone + Send + 'static,
<LayerTy::Service as Service<RequestStreamEvent<()>>>::Future: Send + 'static,
Add a layer to the service to process when a stream begins, or a new connection is created.
§Errors
If there is no on stream begin handler that is currently active.
pub const fn on_stream_end(&self) -> Option<&UnderlyingOnStreamEndService<()>>
Sourcepub fn set_raw_on_stream_end(
&mut self,
on_end: Option<UnderlyingOnStreamEndService<()>>,
) -> Result<(), CommonNetAPIError>
pub fn set_raw_on_stream_end( &mut self, on_end: Option<UnderlyingOnStreamEndService<()>>, ) -> Result<(), CommonNetAPIError>
Set a hook to run when a stream is being destroyed.
This is what happens when a machine disconnects. So it may also be
refered to as “on disconnect”. This assumes you’re assigning a service
that already exists and is in the raw storage type, you may want to
look into Self::set_on_stream_end, or
Self::set_on_stream_end_service.
§Errors
If the stream ending hook has already been registered. If you’re looking to perform multiple actions at once, look into layer-ing.
Sourcepub fn set_on_stream_end<HandlerTy, HandlerParamsTy>(
&mut self,
handler: HandlerTy,
) -> Result<(), CommonNetAPIError>where
HandlerParamsTy: Send + 'static,
HandlerTy: OnRequestStreamEndHandler<HandlerParamsTy, ()> + Clone + Send + 'static,
pub fn set_on_stream_end<HandlerTy, HandlerParamsTy>(
&mut self,
handler: HandlerTy,
) -> Result<(), CommonNetAPIError>where
HandlerParamsTy: Send + 'static,
HandlerTy: OnRequestStreamEndHandler<HandlerParamsTy, ()> + Clone + Send + 'static,
Set a function hook to run when a stream is being destroyed.
This is what happens when a machine disconnects. So it may also be
refered to as “on disconnect”. This assumes you’re assigning a function
to on stream end otherwise use Self::set_raw_on_stream_end,
or Self::set_on_stream_end_service.
§Errors
If the stream ending hook has already been registered. If you’re looking to perform multiple actions at once, look into layer-ing.
Sourcepub fn set_on_stream_end_service<ServiceTy>(
&mut self,
service_ty: ServiceTy,
) -> Result<(), CommonNetAPIError>where
ServiceTy: Clone + Send + Service<RequestStreamEvent<()>, Response = (), Error = CatBridgeError> + 'static,
ServiceTy::Future: Send + 'static,
pub fn set_on_stream_end_service<ServiceTy>(
&mut self,
service_ty: ServiceTy,
) -> Result<(), CommonNetAPIError>where
ServiceTy: Clone + Send + Service<RequestStreamEvent<()>, Response = (), Error = CatBridgeError> + 'static,
ServiceTy::Future: Send + 'static,
Set a function hook to run when a stream is being destroyed.
This is what happens when a machine disconnects. So it may also be
refered to as “on disconnect”. This assumes you’re assigning a Service
to on stream end otherwise use Self::set_raw_on_stream_end,
or Self::set_on_stream_end.
§Errors
If the stream beginning hook has already been registered. If you’re looking to perform multiple actions at once, look into layer-ing.
Sourcepub fn layer_on_stream_end<LayerTy, ServiceTy>(
&mut self,
layer: LayerTy,
) -> Result<(), CommonNetAPIError>where
LayerTy: Layer<UnderlyingOnStreamEndService<()>, Service = ServiceTy>,
ServiceTy: Service<RequestStreamEvent<()>, Response = (), Error = CatBridgeError> + Clone + Send + 'static,
<LayerTy::Service as Service<RequestStreamEvent<()>>>::Future: Send + 'static,
pub fn layer_on_stream_end<LayerTy, ServiceTy>(
&mut self,
layer: LayerTy,
) -> Result<(), CommonNetAPIError>where
LayerTy: Layer<UnderlyingOnStreamEndService<()>, Service = ServiceTy>,
ServiceTy: Service<RequestStreamEvent<()>, Response = (), Error = CatBridgeError> + Clone + Send + 'static,
<LayerTy::Service as Service<RequestStreamEvent<()>>>::Future: Send + 'static,
Add a layer to the service to process when a stream ends, or a new connection is destroyed.
§Errors
If there is no on stream end handler that is currently active.
Sourcepub async fn bind<AddrTy: ToSocketAddrs>(
&self,
address: AddrTy,
) -> Result<(), CatBridgeError>
pub async fn bind<AddrTy: ToSocketAddrs>( &self, address: AddrTy, ) -> Result<(), CatBridgeError>
“Bind” this client to listen on a specific address.
I know this is unusual for a “TCP Client”, binding is for servers? I mean who exactly would be binding to an address as a client? However, certain protocols used for PCFS & the like are “reverse”. E.g. the pc the server connects to the “client” the MION listening on a server.
TCP Servers also have a “connect” method for this very reason.
§Errors
If we cannot spin up a server to listen on this host. This doesn’t mean
someone is connected, just that we’re listening. You may want to use:
TCPClient::wait_for_connection.
Sourcepub async fn wait_for_connection(&self)
pub async fn wait_for_connection(&self)
This will be an async function that will not return until at least one server has connected to our client.
Sourcepub async fn connect<AddrTy: ToSocketAddrs>(
&self,
address: AddrTy,
) -> Result<u64, CatBridgeError>
pub async fn connect<AddrTy: ToSocketAddrs>( &self, address: AddrTy, ) -> Result<u64, CatBridgeError>
Connect to a new server as a raw TCP client.
This method will return the stream id to use for later requests to specific streams.
§Errors
If we can’t connect to the remote TCP Server completing the three way handshake, or if we the stream begin handler returns an error/failure of some kind.
Sourcepub async fn send<ErrorTy: Debug, BodyTy: TryInto<Bytes, Error = ErrorTy>>(
&self,
body: BodyTy,
wait_for_response_timeout: Option<Duration>,
) -> Result<(u64, RequestID, Option<Response>), NetworkError>
pub async fn send<ErrorTy: Debug, BodyTy: TryInto<Bytes, Error = ErrorTy>>( &self, body: BodyTy, wait_for_response_timeout: Option<Duration>, ) -> Result<(u64, RequestID, Option<Response>), NetworkError>
Send a series of bytes over the wire potentially receiving responses back.
This will always only take the response from the ‘primary server’. Even if other servers respond first or at all. It will always be the primary response.
If you want to truly access all the client streams at once use
Self::broadcast_send to send to all, and receive all their responses
back.
This will return the stream that was used as the ‘primary’, the request-id to wait for a response later or otherwise, and the optional response if we waited for one.
§Errors
This function will error if we run into any issues writing or reading the bytes from the stream in a timely manner.
Sourcepub async fn send_with_read_amount<ErrorTy: Debug, BodyTy: TryInto<Bytes, Error = ErrorTy>>(
&self,
body: BodyTy,
wait_for_response_timeout: Option<Duration>,
explicit_read_amount: usize,
) -> Result<(u64, RequestID, Option<Response>), NetworkError>
pub async fn send_with_read_amount<ErrorTy: Debug, BodyTy: TryInto<Bytes, Error = ErrorTy>>( &self, body: BodyTy, wait_for_response_timeout: Option<Duration>, explicit_read_amount: usize, ) -> Result<(u64, RequestID, Option<Response>), NetworkError>
Send a series of bytes over the wire potentially receiving responses back.
This will always only take the response from the ‘primary server’. Even if other servers respond first or at all. It will always be the primary response.
If you want to truly access all the client streams at once use
Self::broadcast_send to send to all, and receive all their responses
back.
This will return the stream that was used as the ‘primary’, the request-id to wait for a response later or otherwise, and the optional response if we waited for one.
§Errors
This function will error if we run into any issues writing or reading the bytes from the stream in a timely manner.
Sourcepub async fn broadcast_send<ErrorTy: Debug, BodyTy: TryInto<Bytes, Error = ErrorTy>>(
&self,
body: BodyTy,
wait_for_response_timeout: Duration,
) -> Result<FnvHashMap<u64, Option<Response>>, CatBridgeError>
pub async fn broadcast_send<ErrorTy: Debug, BodyTy: TryInto<Bytes, Error = ErrorTy>>( &self, body: BodyTy, wait_for_response_timeout: Duration, ) -> Result<FnvHashMap<u64, Option<Response>>, CatBridgeError>
The equivalent of [send], but get all the responses back out of this
client.
§Errors
If we timeout, or run into any sort of error sending or receiving content from a stream.
Sourcepub async fn receive(
&self,
wait_until: Duration,
) -> Result<Option<Response>, NetworkError>
pub async fn receive( &self, wait_until: Duration, ) -> Result<Option<Response>, NetworkError>
Receive a packet from the primary stream.
Used for out-of-band receiving of packets that don’t have an associated
Self::send call.
§Errors
If we timeout, or have another series of failures reading bytes from our stream.
Sourcepub async fn take_all_response_for_request_id(
&self,
request_id: &RequestID,
wait_for: Duration,
) -> FnvHashMap<u64, Option<Response>>
pub async fn take_all_response_for_request_id( &self, request_id: &RequestID, wait_for: Duration, ) -> FnvHashMap<u64, Option<Response>>
Get all the responses for a particular request id.
In order to keep memory from ballooning up, and the fact that TCP is ordered. This API also expects to be called in an ‘ordered’ way. Previous requests that do not match the request id will be dropped.
Trait Implementations§
Source§impl Structable for TCPClient
impl Structable for TCPClient
Source§fn definition(&self) -> StructDef<'_>
fn definition(&self) -> StructDef<'_>
Auto Trait Implementations§
impl Freeze for TCPClient
impl !RefUnwindSafe for TCPClient
impl Send for TCPClient
impl !Sync for TCPClient
impl Unpin for TCPClient
impl !UnwindSafe for TCPClient
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> 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<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§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 moreSource§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