Skip to main content

Topology

Struct Topology 

Source
pub struct Topology { /* private fields */ }
Expand description

A Processor-API topology under construction.

Node insertion order is significant. It sets the subtopology indices, which match the JVM.

Implementations§

Source§

impl Topology

Source

pub fn new() -> Self

Source

pub fn add_source<K, V>( &mut self, name: impl Into<String>, topics: impl IntoIterator<Item = impl Into<String>>, ) -> NodeHandle<K, V>
where K: Any + Send + Sync + Clone + DefaultSerde, V: Any + Send + Sync + Clone + DefaultSerde,

Add a source node reading the given external topics with the default serdes for K and V, returning a typed NodeHandle used to wire children to it.

Use Topology::add_source_explicit when either type has no default serde or when a topology needs custom serdes.

Source

pub fn add_source_explicit<K, V, KS, VS>( &mut self, name: impl Into<String>, topics: impl IntoIterator<Item = impl Into<String>>, consumed: impl Into<Consumed<KS, VS>>, ) -> NodeHandle<K, V>
where K: Any + Send + Clone, V: Any + Send + Clone, KS: Serde<K> + Clone, VS: Serde<V> + Clone,

Add a source node reading the given external topics with explicit serdes, returning a typed NodeHandle used to wire children to it.

consumed carries the key serde and the value serde. At runtime they deserialize incoming bytes into typed Record<K, V> values. Write it as Consumed::with(key_serde, value_serde) so the two roles are visible.

Prefer Topology::add_source, the default-serde form, for types that implement DefaultSerde. Use this escape hatch when a type has no default serde, or to override the default for a topic. Examples are a hand-rolled Serde<T>, a key-role schema serde (AvroSerde::<T>::key(&cache)), and a validation-on JSON serde (JsonSerde::value(&cache, true)).

Source

pub fn add_processor<KIn, VIn, KOut, VOut, S, P, I>( &mut self, name: impl Into<String>, supplier: S, parents: I, ) -> NodeHandle<KOut, VOut>
where KIn: Any + Send, VIn: Any + Send, KOut: Any + Send + Clone, VOut: Any + Send + Clone, S: ProcessorSupplier<KIn, VIn, KOut, VOut> + Clone, I: IntoIterator<Item = P>, P: Borrow<NodeHandle<KIn, VIn>>,

Add a processor node fed by the given parent NodeHandles, returning a handle for its output.

Wiring is by value. Every parent’s output type must equal this processor’s input type (KIn, VIn), and the compiler enforces this. supplier produces a fresh Processor per task. The closure form || MyProc satisfies ProcessorSupplier through a blanket impl, and it infers all four KV type parameters from the processor’s Processor impl, so callers never annotate them.

Source

pub fn add_sink<K, V>( &mut self, name: impl Into<String>, topic: impl Into<String>, parents: impl IntoIterator<Item = impl Borrow<NodeHandle<K, V>>>, )
where K: Any + Send + Sync + DefaultSerde, V: Any + Send + Sync + DefaultSerde,

Add a sink node writing to topic with the default serdes for K and V, fed by the given parent NodeHandles. Every parent’s output type must equal the sink’s input type (K, V), and the compiler enforces this.

Use Topology::add_sink_explicit when either type has no default serde or when a topology needs custom serdes.

Source

pub fn add_sink_explicit<K, V, KS, VS, P, I>( &mut self, name: impl Into<String>, topic: impl Into<String>, parents: I, produced: impl Into<Produced<KS, VS>>, )
where K: Any + Send, V: Any + Send, KS: Serde<K> + Clone, VS: Serde<V> + Clone, I: IntoIterator<Item = P>, P: Borrow<NodeHandle<K, V>>,

Add a sink node writing to topic with explicit serdes, fed by the given parent NodeHandles. Every parent’s output type must equal the sink’s input type (K, V), and the compiler enforces this.

produced carries the key serde and the value serde that serialize outgoing records. Write it as Produced::with(key_serde, value_serde). A sink is terminal, so this method returns nothing.

Prefer Topology::add_sink, the default-serde form, for types that implement DefaultSerde. Use this escape hatch when a type has no default serde, or to override the default for a topic. Examples are a hand-rolled Serde<T>, a key-role schema serde (AvroSerde::<T>::key(&cache)), and a validation-on JSON serde (JsonSerde::value(&cache, true)).

Source

pub fn add_state_store<K, V, KS, VS>( &mut self, name: impl Into<String>, key_serde: KS, value_serde: VS, processors: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self
where K: Send + 'static, V: Send + 'static, KS: Serde<K> + Clone, VS: Serde<V> + Clone,

Register a state store connected to the given processors, with a changelog.

key_serde and value_serde define how the store serializes records into the changelog topic (<app_id>-<name>-changelog) and into the store’s byte map. Stores connect processors that can have different types, so the processor list uses names. Pass NodeHandle::name for a handle you hold.

Source

pub fn add_state_store_with_changelog<K, V, KS, VS>( &mut self, name: impl Into<String>, key_serde: KS, value_serde: VS, processors: impl IntoIterator<Item = impl Into<String>>, changelog_topic: impl Into<String>, ) -> &mut Self
where K: Send + 'static, V: Send + 'static, KS: Serde<K> + Clone, VS: Serde<V> + Clone,

Register a state store whose changelog is an existing source topic rather than the derived <app_id>-<name>-changelog.

This backs the REUSE_KTABLE_SOURCE_TOPICS DSL optimizer. A builder.table_explicit(topic, ...) store can reuse topic as its changelog. No separate app-<store>-changelog topic is created, and the wire topology lists topic as the store’s changelog. changelog_topic is the topic name used both in the wire state_changelog_topics entry and as the runtime store’s changelog target.

Source

pub fn add_window_store<K, V, KS, VS>( &mut self, name: impl Into<String>, key_serde: KS, value_serde: VS, window: (Time, Time, Time), processors: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self
where K: Send + 'static, V: Send + 'static, KS: Serde<K> + Clone, VS: Serde<V> + Clone,

Register a windowed state store connected to the given processors.

Like add_state_store but for windowed stores. The changelog topic carries compact,delete configs and a retention.ms derived from size + grace + [CHANGELOG_ADDITIONAL_RETENTION].

The tuple is (retention_basis, window_size, grace). The retention basis sets the changelog retention.ms. For tumbling and hopping windows it equals the window size. For sliding windows it is the retention span (2 * time_difference), which is wider than the window.

The window size is the true window length. Only the store’s cache flush uses it, to rebuild the downstream Windowed<K> key’s end = start + window_size, because the store-key bytes hold only the start. For sliding windows this is time_difference (1x), NOT the retention span.

Source

pub fn add_join_window_store<K, V, KS, VS>( &mut self, name: impl Into<String>, key_serde: KS, value_serde: VS, window: (Time, Time, Time), processors: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self
where K: Send + 'static, V: Send + 'static, KS: Serde<K> + Clone, VS: Serde<V> + Clone,

Register a join window state store connected to the given processors.

Like add_window_store but for join window stores (retainDuplicates). The changelog topic carries delete-only configs and a retention.ms derived from before + after + grace + [CHANGELOG_ADDITIONAL_RETENTION]. Compaction is not applicable because the store retains duplicates.

Source

pub fn add_session_store<K, V, KS, VS>( &mut self, name: impl Into<String>, key_serde: KS, value_serde: VS, gap: Time, grace: Time, processors: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self
where K: Send + 'static, V: Send + 'static, KS: Serde<K> + Clone, VS: Serde<V> + Clone,

Register a session state store connected to the given processors.

Like add_window_store but for session stores. It reuses the windowed (compact,delete) changelog config. The retention.ms comes from gap + grace + [CHANGELOG_ADDITIONAL_RETENTION]. The store holds the raw aggregate (SessionBytesStore).

Source

pub fn add_versioned_store<K, V, KS, VS>( &mut self, name: impl Into<String>, key_serde: KS, value_serde: VS, history_retention: Time, processors: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self
where K: Send + Sync + 'static, V: Send + 'static, KS: Serde<K> + Clone, VS: Serde<V> + Clone,

Register a versioned state store (KIP-889) connected to the given processors.

The changelog topic carries compact + min.compaction.lag.ms = history_retention + [CHANGELOG_ADDITIONAL_RETENTION]. The version-chain store is self-contained in memory, so it does not use the supplied byte backend.

Source

pub fn add_versioned_store_with_changelog<K, V, KS, VS>( &mut self, name: impl Into<String>, key_serde: KS, value_serde: VS, history_retention: Time, processors: impl IntoIterator<Item = impl Into<String>>, changelog_topic: impl Into<String>, ) -> &mut Self
where K: Send + Sync + 'static, V: Send + 'static, KS: Serde<K> + Clone, VS: Serde<V> + Clone,

Like add_versioned_store but the changelog is an existing source topic. The REUSE_KTABLE_SOURCE_TOPICS optimizer points a versioned builder.table_explicit(topic, …) store’s changelog at its own source topic. This mirrors add_state_store_with_changelog.

Source

pub fn add_suppress_store<K, V, KS, VS>( &mut self, name: impl Into<String>, key_serde: KS, value_serde: VS, logging: bool, processors: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self
where K: Send + 'static, V: Send + 'static, KS: Serde<K> + Clone, VS: Serde<V> + Clone,

Register a suppress buffer store connected to the given processor.

The suppress buffer (SuppressBytesStore) is a time-ordered in-memory buffer with its own storage. It does NOT use the pluggable byte backend, so the factory ignores the opened backend.

logging toggles ONLY the changelog. When true, the wire topology gets the changelog topic, a plain cleanup.policy=compact changelog, because the JVM suppress buffer is a compacted KV store, and the store logs and restores. When false, the store stays in memory and NO changelog topic appears, so a logging-off suppress has the same wire shape as an unsuppressed topology.

Source

pub fn add_global_store<K, V, KS, VS>( &mut self, store_name: impl Into<String>, source_name: impl Into<String>, topic: impl Into<String>, processor_name: impl Into<String>, consumed: impl Into<Consumed<KS, VS>>, ) -> &mut Self
where K: Send + 'static, V: Send + 'static, KS: Serde<K> + Clone, VS: Serde<V> + Clone,

Register a GlobalKTable source, update-processor, and KV store.

A GlobalKTable is invisible in the wire. It has no subtopology of its own and no changelog topic. Its source node still takes a node-group index during grouping, so other subtopology ids shift. This method does three things:

  1. it registers a source node reading topic and a processor node fed by it, and the source→processor edge unites them into one node group;
  2. it marks topic global so the grouping pass skips it in the source-bucketing pass. The final filter drops the resulting source-less group, but that group already took its index;
  3. it stores the global KV factory in a SEPARATE map (global_store_factories, NOT store_factories) so per-task instantiate does not build it and NO changelog topic is emitted. The factory builds a KeyValueBytesStore with an empty changelog.

Per-task instantiate does not build the global store. The fully-replicated global-store manager reads the factory.

Source

pub fn connect_processor_store( &mut self, processor: &str, store: &str, ) -> &mut Self

Connect an additional processor to an already-registered state store.

This mirrors InternalTopologyBuilder.connectProcessorAndStateStores. A join processor must read the joined table’s store even though it was not the store’s original owner. The grouping pass unions all connected processors into one subtopology, so a second processor here is enough to pull the join processor into the same subtopology as the store.

Source

pub fn add_repartition_topic<S: Into<String>>(&mut self, name: S) -> &mut Self

Register a topic name as an internal repartition topic.

Source

pub fn add_copartition_group( &mut self, topics: impl IntoIterator<Item = impl Into<String>>, ) -> &mut Self

Declare a copartition group. The given member topics must share a partitioning.

The grouping pass assigns the group to the subtopology that reads its members. The wire layer encodes member names as int16 indices into that subtopology’s sorted source and repartition arrays. Joins need this (KIP-1071).

Source

pub fn build<S: Into<String>>( self, application_id: S, ) -> Result<BuiltTopology, TopologyError>

Derive subtopologies and the wire topology.

application_id sets the internal-topic names (<app>-<store>-changelog).

The typed NodeHandle wiring already guarantees that parent→child KV types match, so build() checks only the structural invariants: no duplicate names, every predecessor exists, and at least one source. The wire Topology is byte-identical to the untyped implementation.

§Errors

Returns an error when configuration is invalid, protocol encoding fails, the broker rejects the request, or transport I/O fails.

Trait Implementations§

Source§

impl Debug for Topology

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Topology

Source§

fn default() -> Topology

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<K, Q> Comparable<Q> for K
where K: Borrow<Q> + ?Sized, Q: Ord + ?Sized,

§

fn compare(&self, key: &Q) -> Ordering

Compare self to key and return their ordering.
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<K, Q> Equivalent<Q> for K
where K: Borrow<Q> + ?Sized, Q: Eq + ?Sized,

§

fn equivalent(&self, key: &Q) -> bool

Compare self to key and return true if they are equal.
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Fruit for T
where T: Send + Downcast,

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
§

impl<T> Paint for T
where T: ?Sized,

§

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();
§

fn primary(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Primary].

§Example
println!("{}", value.primary());
§

fn fixed(&self, color: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Fixed].

§Example
println!("{}", value.fixed(color));
§

fn rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Rgb].

§Example
println!("{}", value.rgb(r, g, b));
§

fn black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Black].

§Example
println!("{}", value.black());
§

fn red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Red].

§Example
println!("{}", value.red());
§

fn green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Green].

§Example
println!("{}", value.green());
§

fn yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Yellow].

§Example
println!("{}", value.yellow());
§

fn blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Blue].

§Example
println!("{}", value.blue());
§

fn magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Magenta].

§Example
println!("{}", value.magenta());
§

fn cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Cyan].

§Example
println!("{}", value.cyan());
§

fn white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: White].

§Example
println!("{}", value.white());
§

fn bright_black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlack].

§Example
println!("{}", value.bright_black());
§

fn bright_red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightRed].

§Example
println!("{}", value.bright_red());
§

fn bright_green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightGreen].

§Example
println!("{}", value.bright_green());
§

fn bright_yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightYellow].

§Example
println!("{}", value.bright_yellow());
§

fn bright_blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlue].

§Example
println!("{}", value.bright_blue());
§

fn bright_magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.bright_magenta());
§

fn bright_cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightCyan].

§Example
println!("{}", value.bright_cyan());
§

fn bright_white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightWhite].

§Example
println!("{}", value.bright_white());
§

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();
§

fn on_primary(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Primary].

§Example
println!("{}", value.on_primary());
§

fn on_fixed(&self, color: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Fixed].

§Example
println!("{}", value.on_fixed(color));
§

fn on_rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Rgb].

§Example
println!("{}", value.on_rgb(r, g, b));
§

fn on_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Black].

§Example
println!("{}", value.on_black());
§

fn on_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Red].

§Example
println!("{}", value.on_red());
§

fn on_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Green].

§Example
println!("{}", value.on_green());
§

fn on_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Yellow].

§Example
println!("{}", value.on_yellow());
§

fn on_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Blue].

§Example
println!("{}", value.on_blue());
§

fn on_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Magenta].

§Example
println!("{}", value.on_magenta());
§

fn on_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Cyan].

§Example
println!("{}", value.on_cyan());
§

fn on_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: White].

§Example
println!("{}", value.on_white());
§

fn on_bright_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlack].

§Example
println!("{}", value.on_bright_black());
§

fn on_bright_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightRed].

§Example
println!("{}", value.on_bright_red());
§

fn on_bright_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightGreen].

§Example
println!("{}", value.on_bright_green());
§

fn on_bright_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightYellow].

§Example
println!("{}", value.on_bright_yellow());
§

fn on_bright_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlue].

§Example
println!("{}", value.on_bright_blue());
§

fn on_bright_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.on_bright_magenta());
§

fn on_bright_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightCyan].

§Example
println!("{}", value.on_bright_cyan());
§

fn on_bright_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightWhite].

§Example
println!("{}", value.on_bright_white());
§

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();
§

fn bold(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Bold].

§Example
println!("{}", value.bold());
§

fn dim(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Dim].

§Example
println!("{}", value.dim());
§

fn italic(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Italic].

§Example
println!("{}", value.italic());
§

fn underline(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Underline].

§Example
println!("{}", value.underline());

Returns self with the attr() set to [Attribute :: Blink].

§Example
println!("{}", value.blink());

Returns self with the attr() set to [Attribute :: RapidBlink].

§Example
println!("{}", value.rapid_blink());
§

fn invert(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Invert].

§Example
println!("{}", value.invert());
§

fn conceal(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Conceal].

§Example
println!("{}", value.conceal());
§

fn strike(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Strike].

§Example
println!("{}", value.strike());
§

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();
§

fn mask(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Mask].

§Example
println!("{}", value.mask());
§

fn wrap(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Wrap].

§Example
println!("{}", value.wrap());
§

fn linger(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Linger].

§Example
println!("{}", value.linger());
§

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.

Returns self with the quirk() set to [Quirk :: Clear].

§Example
println!("{}", value.clear());
§

fn resetting(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Resetting].

§Example
println!("{}", value.resetting());
§

fn bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Bright].

§Example
println!("{}", value.bright());
§

fn on_bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: OnBright].

§Example
println!("{}", value.on_bright());
§

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);
§

fn new(self) -> Painted<Self>
where Self: Sized,

Create a new [Painted] with a default [Style]. Read more
§

fn paint<S>(&self, style: S) -> Painted<&Self>
where S: Into<Style>,

Apply a style wholesale to self. Any previous style is replaced. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more