pub struct SentinelProxy {
pub config_manager: Arc<ConfigManager>,
/* private fields */
}Expand description
Main proxy service implementing Pingora’s ProxyHttp trait
Fields§
§config_manager: Arc<ConfigManager>Configuration manager with hot reload
Implementations§
Trait Implementations§
Source§impl ProxyHttp for SentinelProxy
impl ProxyHttp for SentinelProxy
Source§type CTX = RequestContext
type CTX = RequestContext
The per request object to share state across the different filters
Source§fn fail_to_connect(
&self,
_session: &mut Session,
_peer: &HttpPeer,
_ctx: &mut Self::CTX,
e: Box<Error>,
) -> Box<Error>
fn fail_to_connect( &self, _session: &mut Session, _peer: &HttpPeer, _ctx: &mut Self::CTX, e: Box<Error>, ) -> Box<Error>
This filter is called when there is an error in the process of establishing a connection
to the upstream. Read more
Source§fn upstream_peer<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session: &'life1 mut Session,
ctx: &'life2 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = Result<Box<HttpPeer>, Box<Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn upstream_peer<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session: &'life1 mut Session,
ctx: &'life2 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = Result<Box<HttpPeer>, Box<Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Define where the proxy should send the request to. Read more
Source§fn request_filter<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session: &'life1 mut Session,
ctx: &'life2 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = Result<bool, Box<Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn request_filter<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session: &'life1 mut Session,
ctx: &'life2 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = Result<bool, Box<Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Handle the incoming request. Read more
Source§fn response_filter<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_session: &'life1 mut Session,
upstream_response: &'life2 mut ResponseHeader,
ctx: &'life3 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = Result<(), Box<Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn response_filter<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_session: &'life1 mut Session,
upstream_response: &'life2 mut ResponseHeader,
ctx: &'life3 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = Result<(), Box<Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Modify the response header before it is send to the downstream Read more
Source§fn logging<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
session: &'life1 mut Session,
_error: Option<&'life2 Error>,
ctx: &'life3 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn logging<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
session: &'life1 mut Session,
_error: Option<&'life2 Error>,
ctx: &'life3 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
This filter is called when the entire response is sent to the downstream successfully or
there is a fatal error that terminate the request. Read more
Source§fn init_downstream_modules(&self, modules: &mut HttpModules)
fn init_downstream_modules(&self, modules: &mut HttpModules)
Set up downstream modules. Read more
Source§fn early_request_filter<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_session: &'life1 mut Session,
_ctx: &'life2 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = Result<(), Box<Error>>> + Send + 'async_trait>>
fn early_request_filter<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _session: &'life1 mut Session, _ctx: &'life2 mut Self::CTX, ) -> Pin<Box<dyn Future<Output = Result<(), Box<Error>>> + Send + 'async_trait>>
Handle the incoming request before any downstream module is executed. Read more
Source§fn request_body_filter<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_session: &'life1 mut Session,
_body: &'life2 mut Option<Bytes>,
_end_of_stream: bool,
_ctx: &'life3 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = Result<(), Box<Error>>> + Send + 'async_trait>>
fn request_body_filter<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _session: &'life1 mut Session, _body: &'life2 mut Option<Bytes>, _end_of_stream: bool, _ctx: &'life3 mut Self::CTX, ) -> Pin<Box<dyn Future<Output = Result<(), Box<Error>>> + Send + 'async_trait>>
Handle the incoming request body. Read more
Source§fn request_cache_filter(
&self,
_session: &mut Session,
_ctx: &mut Self::CTX,
) -> Result<(), Box<Error>>
fn request_cache_filter( &self, _session: &mut Session, _ctx: &mut Self::CTX, ) -> Result<(), Box<Error>>
This filter decides if the request is cacheable and what cache backend to use Read more
Source§fn cache_key_callback(
&self,
session: &Session,
_ctx: &mut Self::CTX,
) -> Result<CacheKey, Box<Error>>
fn cache_key_callback( &self, session: &Session, _ctx: &mut Self::CTX, ) -> Result<CacheKey, Box<Error>>
This callback generates the cache key Read more
Source§fn cache_miss(&self, session: &mut Session, _ctx: &mut Self::CTX)
fn cache_miss(&self, session: &mut Session, _ctx: &mut Self::CTX)
This callback is invoked when a cacheable response is ready to be admitted to cache
Source§fn cache_hit_filter<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
_session: &'life1 mut Session,
_meta: &'life2 CacheMeta,
_hit_handler: &'life3 mut Box<dyn HandleHit + Send + Sync>,
_is_fresh: bool,
_ctx: &'life4 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = Result<Option<ForcedInvalidationKind>, Box<Error>>> + Send + 'async_trait>>
fn cache_hit_filter<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _session: &'life1 mut Session, _meta: &'life2 CacheMeta, _hit_handler: &'life3 mut Box<dyn HandleHit + Send + Sync>, _is_fresh: bool, _ctx: &'life4 mut Self::CTX, ) -> Pin<Box<dyn Future<Output = Result<Option<ForcedInvalidationKind>, Box<Error>>> + Send + 'async_trait>>
This filter is called after a successful cache lookup and before the
cache asset is ready to be used. Read more
Source§fn proxy_upstream_filter<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_session: &'life1 mut Session,
_ctx: &'life2 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = Result<bool, Box<Error>>> + Send + 'async_trait>>
fn proxy_upstream_filter<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _session: &'life1 mut Session, _ctx: &'life2 mut Self::CTX, ) -> Pin<Box<dyn Future<Output = Result<bool, Box<Error>>> + Send + 'async_trait>>
Decide if a request should continue to upstream after not being served from cache. Read more
Source§fn response_cache_filter(
&self,
_session: &Session,
_resp: &ResponseHeader,
_ctx: &mut Self::CTX,
) -> Result<RespCacheable, Box<Error>>
fn response_cache_filter( &self, _session: &Session, _resp: &ResponseHeader, _ctx: &mut Self::CTX, ) -> Result<RespCacheable, Box<Error>>
Decide if the response is cacheable
Source§fn cache_vary_filter(
&self,
_meta: &CacheMeta,
_ctx: &mut Self::CTX,
_req: &RequestHeader,
) -> Option<[u8; 16]>
fn cache_vary_filter( &self, _meta: &CacheMeta, _ctx: &mut Self::CTX, _req: &RequestHeader, ) -> Option<[u8; 16]>
Decide how to generate cache vary key from both request and response Read more
Source§fn cache_not_modified_filter(
&self,
session: &Session,
resp: &ResponseHeader,
_ctx: &mut Self::CTX,
) -> Result<bool, Box<Error>>
fn cache_not_modified_filter( &self, session: &Session, resp: &ResponseHeader, _ctx: &mut Self::CTX, ) -> Result<bool, Box<Error>>
Decide if the incoming request’s condition fails against the cached response. Read more
Source§fn range_header_filter(
&self,
session: &mut Session,
resp: &mut ResponseHeader,
_ctx: &mut Self::CTX,
) -> RangeType
fn range_header_filter( &self, session: &mut Session, resp: &mut ResponseHeader, _ctx: &mut Self::CTX, ) -> RangeType
This filter is called when cache is enabled to determine what byte range to return (in both
cache hit and miss cases) from the response body. It is only used when caching is enabled,
otherwise the upstream is responsible for any filtering. It allows users to define the range
this request is for via its return type
range_filter::RangeType. Read moreSource§fn upstream_request_filter<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_session: &'life1 mut Session,
_upstream_request: &'life2 mut RequestHeader,
_ctx: &'life3 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = Result<(), Box<Error>>> + Send + 'async_trait>>
fn upstream_request_filter<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _session: &'life1 mut Session, _upstream_request: &'life2 mut RequestHeader, _ctx: &'life3 mut Self::CTX, ) -> Pin<Box<dyn Future<Output = Result<(), Box<Error>>> + Send + 'async_trait>>
Modify the request before it is sent to the upstream Read more
Source§fn upstream_response_filter(
&self,
_session: &mut Session,
_upstream_response: &mut ResponseHeader,
_ctx: &mut Self::CTX,
) -> Result<(), Box<Error>>
fn upstream_response_filter( &self, _session: &mut Session, _upstream_response: &mut ResponseHeader, _ctx: &mut Self::CTX, ) -> Result<(), Box<Error>>
Modify the response header from the upstream Read more
Source§fn upstream_response_body_filter(
&self,
_session: &mut Session,
_body: &mut Option<Bytes>,
_end_of_stream: bool,
_ctx: &mut Self::CTX,
) -> Result<(), Box<Error>>
fn upstream_response_body_filter( &self, _session: &mut Session, _body: &mut Option<Bytes>, _end_of_stream: bool, _ctx: &mut Self::CTX, ) -> Result<(), Box<Error>>
Similar to Self::upstream_response_filter() but for response body Read more
Source§fn upstream_response_trailer_filter(
&self,
_session: &mut Session,
_upstream_trailers: &mut HeaderMap,
_ctx: &mut Self::CTX,
) -> Result<(), Box<Error>>
fn upstream_response_trailer_filter( &self, _session: &mut Session, _upstream_trailers: &mut HeaderMap, _ctx: &mut Self::CTX, ) -> Result<(), Box<Error>>
Similar to Self::upstream_response_filter() but for response trailers
Source§fn response_body_filter(
&self,
_session: &mut Session,
_body: &mut Option<Bytes>,
_end_of_stream: bool,
_ctx: &mut Self::CTX,
) -> Result<Option<Duration>, Box<Error>>
fn response_body_filter( &self, _session: &mut Session, _body: &mut Option<Bytes>, _end_of_stream: bool, _ctx: &mut Self::CTX, ) -> Result<Option<Duration>, Box<Error>>
Similar to Self::response_filter() but for response body chunks
Source§fn response_trailer_filter<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_session: &'life1 mut Session,
_upstream_trailers: &'life2 mut HeaderMap,
_ctx: &'life3 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, Box<Error>>> + Send + 'async_trait>>
fn response_trailer_filter<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _session: &'life1 mut Session, _upstream_trailers: &'life2 mut HeaderMap, _ctx: &'life3 mut Self::CTX, ) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, Box<Error>>> + Send + 'async_trait>>
Similar to Self::response_filter() but for response trailers.
Note, returning an Ok(Some(Bytes)) will result in the downstream response
trailers being written to the response body. Read more
Source§fn suppress_error_log(
&self,
_session: &Session,
_ctx: &Self::CTX,
_error: &Error,
) -> bool
fn suppress_error_log( &self, _session: &Session, _ctx: &Self::CTX, _error: &Error, ) -> bool
A value of true means that the log message will be suppressed. The default value is false.
Source§fn error_while_proxy(
&self,
peer: &HttpPeer,
session: &mut Session,
e: Box<Error>,
_ctx: &mut Self::CTX,
client_reused: bool,
) -> Box<Error>
fn error_while_proxy( &self, peer: &HttpPeer, session: &mut Session, e: Box<Error>, _ctx: &mut Self::CTX, client_reused: bool, ) -> Box<Error>
This filter is called when there is an error after a connection is established (or reused)
to the upstream.
Source§fn fail_to_proxy<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
session: &'life1 mut Session,
e: &'life2 Error,
_ctx: &'life3 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = FailToProxy> + Send + 'async_trait>>
fn fail_to_proxy<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, session: &'life1 mut Session, e: &'life2 Error, _ctx: &'life3 mut Self::CTX, ) -> Pin<Box<dyn Future<Output = FailToProxy> + Send + 'async_trait>>
This filter is called when the request encounters a fatal error. Read more
Source§fn should_serve_stale(
&self,
_session: &mut Session,
_ctx: &mut Self::CTX,
error: Option<&Error>,
) -> bool
fn should_serve_stale( &self, _session: &mut Session, _ctx: &mut Self::CTX, error: Option<&Error>, ) -> bool
Decide whether should serve stale when encountering an error or during revalidation Read more
Source§fn connected_to_upstream<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
_session: &'life1 mut Session,
_reused: bool,
_peer: &'life2 HttpPeer,
_fd: i32,
_digest: Option<&'life3 Digest>,
_ctx: &'life4 mut Self::CTX,
) -> Pin<Box<dyn Future<Output = Result<(), Box<Error>>> + Send + 'async_trait>>
fn connected_to_upstream<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _session: &'life1 mut Session, _reused: bool, _peer: &'life2 HttpPeer, _fd: i32, _digest: Option<&'life3 Digest>, _ctx: &'life4 mut Self::CTX, ) -> Pin<Box<dyn Future<Output = Result<(), Box<Error>>> + Send + 'async_trait>>
This filter is called when the request just established or reused a connection to the upstream Read more
Source§fn request_summary(&self, session: &Session, _ctx: &Self::CTX) -> String
fn request_summary(&self, session: &Session, _ctx: &Self::CTX) -> String
This callback is invoked every time request related error log needs to be generated Read more
Source§fn is_purge(&self, _session: &Session, _ctx: &Self::CTX) -> bool
fn is_purge(&self, _session: &Session, _ctx: &Self::CTX) -> bool
Whether the request should be used to invalidate(delete) the HTTP cache Read more
Source§fn purge_response_filter(
&self,
_session: &Session,
_ctx: &mut Self::CTX,
_purge_status: PurgeStatus,
_purge_response: &mut Cow<'static, ResponseHeader>,
) -> Result<(), Box<Error>>
fn purge_response_filter( &self, _session: &Session, _ctx: &mut Self::CTX, _purge_status: PurgeStatus, _purge_response: &mut Cow<'static, ResponseHeader>, ) -> Result<(), Box<Error>>
This filter is called after the proxy cache generates the downstream response to the purge
request (to invalidate or delete from the HTTP cache), based on the purge status, which
indicates whether the request succeeded or failed. Read more
Auto Trait Implementations§
impl Freeze for SentinelProxy
impl !RefUnwindSafe for SentinelProxy
impl Send for SentinelProxy
impl Sync for SentinelProxy
impl Unpin for SentinelProxy
impl !UnwindSafe for SentinelProxy
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
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>
Converts
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>
Converts
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<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§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,
Set the foreground color generically Read more
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Set the background color generically. Read more
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Change the foreground color to black
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Change the background color to black
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Change the foreground color to red
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Change the background color to red
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Change the foreground color to green
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Change the background color to green
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Change the foreground color to yellow
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Change the background color to yellow
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Change the foreground color to blue
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Change the background color to blue
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Change the foreground color to magenta
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Change the background color to magenta
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Change the foreground color to purple
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Change the background color to purple
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Change the foreground color to cyan
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Change the background color to cyan
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Change the foreground color to white
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Change the background color to white
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Change the foreground color to the terminal default
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Change the background color to the terminal default
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Change the foreground color to bright black
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Change the background color to bright black
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Change the foreground color to bright red
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Change the background color to bright red
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Change the foreground color to bright green
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Change the background color to bright green
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Change the foreground color to bright yellow
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Change the background color to bright yellow
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Change the foreground color to bright blue
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Change the background color to bright blue
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Change the foreground color to bright magenta
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Change the background color to bright magenta
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Change the foreground color to bright purple
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Change the background color to bright purple
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Change the foreground color to bright cyan
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Change the background color to bright cyan
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Change the foreground color to bright white
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Change the background color to bright white
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Make the text bold
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Make the text dim
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Make the text italicized
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Make the text underlined
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Make the text blink
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Make the text blink (but fast!)
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Swap the foreground and background colors
Hide the text
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Cross out the text
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,
Set the foreground color at runtime. Only use if you do not know which color will be used at
compile-time. If the color is constant, use either
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,
Set the background color at runtime. Only use if you do not know what color to use at
compile-time. If the color is constant, use either
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read moreSource§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>
Set the foreground color to a specific RGB value.
Source§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>
Set the background color to a specific RGB value.
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Sets the foreground color to an RGB value.
Source§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>
Sets the background color to an RGB value.