pub struct BatchEngine { /* private fields */ }worker-batch and (crate features worker-batch or worker-pool or worker) only.Expand description
Core batch processing engine for DFE pipelines.
Provides two processing modes:
-
process_mid_tier– parse JSON via SIMD, extract known fields, apply pre-route filters, then parallel transform via rayon. The standard path for most DFE apps (loader, archiver, transforms). -
process_raw– skip parsing, apply pre-route on raw bytes, then parallel transform via rayon. For apps that handle raw bytes (receiver, binary protocols).
Both modes chunk large batches, track stats atomically, and pause between chunks when memory pressure is detected.
Implementations§
Source§impl BatchEngine
impl BatchEngine
Sourcepub fn new(config: BatchProcessingConfig) -> Self
pub fn new(config: BatchProcessingConfig) -> Self
Create a standalone engine with its own worker pool.
Uses WorkerPoolConfig::default() for the pool. Prefer
with_pool when a ServiceRuntime pool exists.
Sourcepub fn with_pool(
pool: Arc<AdaptiveWorkerPool>,
config: BatchProcessingConfig,
) -> Self
pub fn with_pool( pool: Arc<AdaptiveWorkerPool>, config: BatchProcessingConfig, ) -> Self
Create an engine that reuses an existing worker pool.
This is the preferred constructor when ServiceRuntime is available,
as it avoids creating a second rayon thread pool.
Sourcepub fn from_cascade(key: &str) -> Result<Self, ConfigError>
pub fn from_cascade(key: &str) -> Result<Self, ConfigError>
Load configuration from the cascade and create a standalone engine.
§Errors
Returns ConfigError if the cascade contains invalid data.
Sourcepub fn stats(&self) -> &Arc<PipelineStats> ⓘ
pub fn stats(&self) -> &Arc<PipelineStats> ⓘ
Pipeline statistics (atomic, lock-free).
Sourcepub fn pool(&self) -> &Arc<AdaptiveWorkerPool> ⓘ
pub fn pool(&self) -> &Arc<AdaptiveWorkerPool> ⓘ
Underlying worker pool.
Sourcepub fn config(&self) -> &BatchProcessingConfig
pub fn config(&self) -> &BatchProcessingConfig
Engine configuration.
Sourcepub fn auto_wire(
&mut self,
metrics_manager: &MetricsManager,
memory_guard: Option<&Arc<MemoryGuard>>,
)
pub fn auto_wire( &mut self, metrics_manager: &MetricsManager, memory_guard: Option<&Arc<MemoryGuard>>, )
Auto-wire engine with infrastructure components.
Called by ServiceRuntime::build(). Apps never call this directly.
Sourcepub fn process_mid_tier<O, E, F>(
&self,
messages: &[RawMessage],
transform: F,
) -> Vec<Result<O, E>>
pub fn process_mid_tier<O, E, F>( &self, messages: &[RawMessage], transform: F, ) -> Vec<Result<O, E>>
Parse, filter, and transform a batch of raw messages.
Pipeline phases per chunk:
- Pre-route – SIMD field extraction + filter evaluation (sequential, ~100 ns/msg)
- Parse –
sonic_rs::from_slice+ known-field extraction (sequential, ~1-5 µs/msg) - Transform – user closure via rayon
par_iter_mut(parallel)
Results contain one entry per non-filtered message. Filtered messages are
silently removed (their commit tokens remain accessible via the original
slice). DLQ’d and parse-error messages produce Err entries.
Sourcepub fn process_raw<O, E, F>(
&self,
messages: &[RawMessage],
transform: F,
) -> Vec<Result<O, E>>
pub fn process_raw<O, E, F>( &self, messages: &[RawMessage], transform: F, ) -> Vec<Result<O, E>>
Pre-route and transform a batch of raw messages without parsing.
The transform closure receives immutable &RawMessage references.
Use this for apps that handle raw bytes directly (e.g. receiver forwarding).
Sourcepub async fn run<R, O, E, Transform, Sink>(
&self,
receiver: &R,
shutdown: CancellationToken,
transform: Transform,
sink: Sink,
) -> Result<(), EngineError>
Available on crate feature transport only.
pub async fn run<R, O, E, Transform, Sink>( &self, receiver: &R, shutdown: CancellationToken, transform: Transform, sink: Sink, ) -> Result<(), EngineError>
transport only.Transport-wired async run loop for mid-tier (parsed JSON) processing.
Receives up to config.max_chunk_size messages per iteration, converts them
to RawMessage, runs process_mid_tier, calls the
sink, then commits transport tokens only on sink success.
Stops cleanly when shutdown is cancelled.
§Errors
Returns EngineError::Transport if recv or commit fails fatally.
Returns EngineError::Sink if the sink callback errors (commit skipped).
Sourcepub async fn run_raw<R, O, E, Transform, Sink>(
&self,
receiver: &R,
shutdown: CancellationToken,
transform: Transform,
sink: Sink,
) -> Result<(), EngineError>
Available on crate feature transport only.
pub async fn run_raw<R, O, E, Transform, Sink>( &self, receiver: &R, shutdown: CancellationToken, transform: Transform, sink: Sink, ) -> Result<(), EngineError>
transport only.Transport-wired async run loop for raw byte processing.
Like run but uses process_raw: the
transform closure receives &RawMessage bytes without JSON parsing.
§Errors
Returns EngineError::Transport if recv or commit fails fatally.
Returns EngineError::Sink if the sink callback errors (commit skipped).
Sourcepub async fn run_async<R, O, E, Transform, Sink, SinkFut, Ticker, TickerFut>(
&self,
receiver: &R,
shutdown: CancellationToken,
transform: Transform,
sink: Sink,
ticker: Option<(Duration, Ticker)>,
) -> Result<(), EngineError>where
R: TransportReceiver,
O: Send + 'static,
E: Send + From<String> + Display + 'static,
Transform: Fn(&mut ParsedMessage) -> Result<O, E> + Sync,
Sink: FnMut(Vec<Result<O, E>>, Vec<R::Token>) -> SinkFut,
SinkFut: Future<Output = Result<(), EngineError>>,
Ticker: FnMut() -> TickerFut,
TickerFut: Future<Output = Result<(), EngineError>>,
Available on crate feature transport only.
pub async fn run_async<R, O, E, Transform, Sink, SinkFut, Ticker, TickerFut>(
&self,
receiver: &R,
shutdown: CancellationToken,
transform: Transform,
sink: Sink,
ticker: Option<(Duration, Ticker)>,
) -> Result<(), EngineError>where
R: TransportReceiver,
O: Send + 'static,
E: Send + From<String> + Display + 'static,
Transform: Fn(&mut ParsedMessage) -> Result<O, E> + Sync,
Sink: FnMut(Vec<Result<O, E>>, Vec<R::Token>) -> SinkFut,
SinkFut: Future<Output = Result<(), EngineError>>,
Ticker: FnMut() -> TickerFut,
TickerFut: Future<Output = Result<(), EngineError>>,
transport only.Transport-wired async run loop with full control over commit semantics.
Like run but with two key differences:
-
Async sink – the sink is an async closure, enabling async I/O (ClickHouse inserts, Kafka produce, storage writes) inside the sink.
-
Sink-managed commits – the sink receives commit tokens and decides when to commit. The engine does NOT auto-commit. This enables deferred commit patterns (e.g., commit after ClickHouse flush, not after buffer push).
An optional ticker fires on a fixed interval within the select! loop, enabling flush timers and periodic maintenance without breaking out of the engine loop.
§Errors
Returns EngineError::Transport if recv fails fatally.
Returns EngineError::Sink if the sink callback errors.
Sourcepub async fn run_raw_async<R, O, E, Transform, Sink, SinkFut, Ticker, TickerFut>(
&self,
receiver: &R,
shutdown: CancellationToken,
transform: Transform,
sink: Sink,
ticker: Option<(Duration, Ticker)>,
) -> Result<(), EngineError>where
R: TransportReceiver,
O: Send + 'static,
E: Send + From<String> + Display + 'static,
Transform: Fn(&RawMessage) -> Result<O, E> + Sync,
Sink: FnMut(Vec<Result<O, E>>, Vec<R::Token>) -> SinkFut,
SinkFut: Future<Output = Result<(), EngineError>>,
Ticker: FnMut() -> TickerFut,
TickerFut: Future<Output = Result<(), EngineError>>,
Available on crate feature transport only.
pub async fn run_raw_async<R, O, E, Transform, Sink, SinkFut, Ticker, TickerFut>(
&self,
receiver: &R,
shutdown: CancellationToken,
transform: Transform,
sink: Sink,
ticker: Option<(Duration, Ticker)>,
) -> Result<(), EngineError>where
R: TransportReceiver,
O: Send + 'static,
E: Send + From<String> + Display + 'static,
Transform: Fn(&RawMessage) -> Result<O, E> + Sync,
Sink: FnMut(Vec<Result<O, E>>, Vec<R::Token>) -> SinkFut,
SinkFut: Future<Output = Result<(), EngineError>>,
Ticker: FnMut() -> TickerFut,
TickerFut: Future<Output = Result<(), EngineError>>,
transport only.Transport-wired async run loop for raw byte processing with full control.
Like run_async but uses process_raw:
the transform closure receives &RawMessage bytes without JSON parsing.
§Errors
Returns EngineError::Transport if recv fails fatally.
Returns EngineError::Sink if the sink callback errors.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for BatchEngine
impl !UnwindSafe for BatchEngine
impl Freeze for BatchEngine
impl Send for BatchEngine
impl Sync for BatchEngine
impl Unpin for BatchEngine
impl UnsafeUnpin for BatchEngine
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointerSource§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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<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<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
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,
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 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>
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>
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>
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>
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);