pub struct KStream<K, V, KS = <K as DefaultSerde>::Serde, VS = <V as DefaultSerde>::Serde> { /* private fields */ }Implementations§
Source§impl<K, V, KS, VS> KStream<K, V, KS, VS>
impl<K, V, KS, VS> KStream<K, V, KS, VS>
pub fn with_key_serde<NewKS>(self, serde: NewKS) -> KStream<K, V, NewKS, VS>
pub fn with_value_serde<NewVS>(self, serde: NewVS) -> KStream<K, V, KS, NewVS>
Source§impl<K, V, KS, VS> KStream<K, V, KS, VS>
impl<K, V, KS, VS> KStream<K, V, KS, VS>
Sourcepub fn map_values<V2, F>(
&self,
f: F,
) -> KStream<K, V2, KS, <V2 as DefaultSerde>::Serde>
pub fn map_values<V2, F>( &self, f: F, ) -> KStream<K, V2, KS, <V2 as DefaultSerde>::Serde>
mapValues: transform each value, key unchanged. Not key-changing.
Sourcepub fn filter<F>(&self, predicate: F) -> KStream<K, V, KS, VS>
pub fn filter<F>(&self, predicate: F) -> KStream<K, V, KS, VS>
filter: keep records where predicate(key, value) is true.
Sourcepub fn filter_not<F>(&self, predicate: F) -> KStream<K, V, KS, VS>
pub fn filter_not<F>(&self, predicate: F) -> KStream<K, V, KS, VS>
filterNot: keep records where predicate(key, value) is false.
Sourcepub fn map<K2, V2, F>(
&self,
f: F,
) -> KStream<K2, V2, <K2 as DefaultSerde>::Serde, <V2 as DefaultSerde>::Serde>
pub fn map<K2, V2, F>( &self, f: F, ) -> KStream<K2, V2, <K2 as DefaultSerde>::Serde, <V2 as DefaultSerde>::Serde>
map: transform key and value. Key-changing.
Sourcepub fn select_key<K2, F>(
&self,
f: F,
) -> KStream<K2, V, <K2 as DefaultSerde>::Serde, VS>
pub fn select_key<K2, F>( &self, f: F, ) -> KStream<K2, V, <K2 as DefaultSerde>::Serde, VS>
selectKey: rewrite the key, value unchanged. Key-changing.
Sourcepub fn select_key_with_serde<K2, GKS, F>(
&self,
f: F,
key_serde: GKS,
) -> KStream<K2, V, GKS, VS>
pub fn select_key_with_serde<K2, GKS, F>( &self, f: F, key_serde: GKS, ) -> KStream<K2, V, GKS, VS>
selectKey with an explicit key serde. Key-changing.
Sourcepub fn flat_map<K2, V2, IT, F>(
&self,
f: F,
) -> KStream<K2, V2, <K2 as DefaultSerde>::Serde, <V2 as DefaultSerde>::Serde>
pub fn flat_map<K2, V2, IT, F>( &self, f: F, ) -> KStream<K2, V2, <K2 as DefaultSerde>::Serde, <V2 as DefaultSerde>::Serde>
flatMap: one record → zero or more (K2, V2). Key-changing.
Sourcepub fn flat_map_values<V2, IT, F>(
&self,
f: F,
) -> KStream<K, V2, KS, <V2 as DefaultSerde>::Serde>where
V2: DefaultSerde + Any + Send + Clone,
IT: IntoIterator<Item = V2> + 'static,
F: Fn(&V) -> IT + Clone + Send + Sync + 'static,
pub fn flat_map_values<V2, IT, F>(
&self,
f: F,
) -> KStream<K, V2, KS, <V2 as DefaultSerde>::Serde>where
V2: DefaultSerde + Any + Send + Clone,
IT: IntoIterator<Item = V2> + 'static,
F: Fn(&V) -> IT + Clone + Send + Sync + 'static,
flatMapValues: one record → zero or more V2, key unchanged.
Sourcepub fn peek<F>(&self, f: F) -> KStream<K, V, KS, VS>
pub fn peek<F>(&self, f: F) -> KStream<K, V, KS, VS>
peek: observe each record, then forward it unchanged.
Sourcepub fn foreach<F>(self, f: F)
pub fn foreach<F>(self, f: F)
foreach: terminal side-effect on each record (consumes the stream).
Sourcepub fn to_explicit<KS2, VS2>(
self,
topic: impl Into<String>,
produced: impl Into<Produced<KS2, VS2>>,
)
pub fn to_explicit<KS2, VS2>( self, topic: impl Into<String>, produced: impl Into<Produced<KS2, VS2>>, )
to: write the stream to a topic through a sink (consumes the stream).
Sourcepub fn to(self, topic: impl Into<String>)
pub fn to(self, topic: impl Into<String>)
Write the stream to a topic using the default/carried serdes of the stream.
Sourcepub fn merge(&self, other: &KStream<K, V, KS, VS>) -> KStream<K, V, KS, VS>
pub fn merge(&self, other: &KStream<K, V, KS, VS>) -> KStream<K, V, KS, VS>
merge: union this stream with other (same K/V). Both feed one node.
Sourcepub fn join_table<VT, VO, F, VTS>(
&self,
table: &KTable<K, VT, KS, VTS>,
joiner: F,
) -> KStream<K, VO, KS, <VO as DefaultSerde>::Serde>
pub fn join_table<VT, VO, F, VTS>( &self, table: &KTable<K, VT, KS, VTS>, joiner: F, ) -> KStream<K, VO, KS, <VO as DefaultSerde>::Serde>
join (inner stream-table join): look each stream record up in table.
For each record on this stream, this method looks the record’s key up in
table’s materialized store. Only when a value is present, it
forwards joiner(&stream_value, &table_value) keyed by the same key. It
drops records whose key is absent from the table. This is an inner join.
table must be materialized, that is, sourced through
StreamsBuilder::table or any materialized op. The join reads its store
by name. The join declares the stream side and the table’s source topic as
a copartition group (KIP-1071), so the streams-group coordinator
co-locates their partitions.
The stream key must be unchanged relative to its source partitioning,
because a stream-table join is partition-local. If a key-changing op such
as map, select_key, flat_map, or group_by comes before the join,
call repartition first to re-partition by the new
key. If you do not, join_table panics.
§Naming vs the JVM
The JVM overloads join for both stream-table and (windowed) stream-stream
joins. Rust cannot have two inherent methods of the same name and differing
arity, so the stream-table forms are named join_table/left_join_table
here, leaving the plain join/left_join for the windowed stream-stream
join (see KStream::join).
§Panics
Panics if synchronized client state is poisoned or a response violates an invariant established by protocol validation.
Sourcepub fn left_join_table<VT, VO, F, VTS>(
&self,
table: &KTable<K, VT, KS, VTS>,
joiner: F,
) -> KStream<K, VO, KS, <VO as DefaultSerde>::Serde>
pub fn left_join_table<VT, VO, F, VTS>( &self, table: &KTable<K, VT, KS, VTS>, joiner: F, ) -> KStream<K, VO, KS, <VO as DefaultSerde>::Serde>
leftJoin (left stream-table join): like join_table
but always forwards a record for every stream record. On a table miss the
joiner receives None for the table-side value. See
join_table for the naming-vs-JVM note.
Sourcepub fn join_table_with<VT, VO, F, VTS>(
&self,
table: &KTable<K, VT, KS, VTS>,
joiner: F,
join_config: Joined,
) -> KStream<K, VO, KS, <VO as DefaultSerde>::Serde>
pub fn join_table_with<VT, VO, F, VTS>( &self, table: &KTable<K, VT, KS, VTS>, joiner: F, join_config: Joined, ) -> KStream<K, VO, KS, <VO as DefaultSerde>::Serde>
join with Joined config (KIP-923 grace path).
This method is identical to join_table when
joined.grace is None. When a grace period is set, the join buffers
each stream record into a JoinGraceBufferStore. It drains the buffer
as-of the record’s own timestamp once the grace horizon passes.
Out-of-order stream records therefore join against the table version that
was current at the record’s own timestamp.
Grace requires the table to be versioned. See
Materialized::as_versioned. grace must be strictly less than the
table’s history_retention.
§Panics
Panics if synchronized client state is poisoned or a response violates an invariant established by protocol validation.
Sourcepub fn left_join_table_with<VT, VO, F, VTS>(
&self,
table: &KTable<K, VT, KS, VTS>,
joiner: F,
join_config: Joined,
) -> KStream<K, VO, KS, <VO as DefaultSerde>::Serde>
pub fn left_join_table_with<VT, VO, F, VTS>( &self, table: &KTable<K, VT, KS, VTS>, joiner: F, join_config: Joined, ) -> KStream<K, VO, KS, <VO as DefaultSerde>::Serde>
leftJoin with Joined config (KIP-923 grace path). Like
left_join_table but, when joined.grace is
set, wires the grace buffer + as-of drain (see
join_table_with). On a table miss at drain time
the joiner receives None.
Sourcepub fn join_global<GK, VG, VR, KM, J, GKS, VGS>(
&self,
global: &GlobalKTable<GK, VG, GKS, VGS>,
key_mapper: KM,
joiner: J,
) -> KStream<K, VR, KS, <VR as DefaultSerde>::Serde>
pub fn join_global<GK, VG, VR, KM, J, GKS, VGS>( &self, global: &GlobalKTable<GK, VG, GKS, VGS>, key_mapper: KM, joiner: J, ) -> KStream<K, VR, KS, <VR as DefaultSerde>::Serde>
join (inner stream-globaltable join): look each record up in global.
For each record on this stream, this method computes the lookup key
gk = key_mapper(&streamKey, &streamValue) and looks it up in global’s
fully-replicated store. Only on a hit, it forwards
joiner(&stream_value, &global_value) keyed by the stream key with
the stream timestamp. It drops records whose derived key is absent.
The lookup key is derived from the record, unlike
join_table, so it can differ from the stream key. A
GlobalKTable is fully replicated, so there is no copartitioning, no
repartition, and no key-changing assertion. Any record can look up any
key on every instance.
§Panics
Panics if synchronized client state is poisoned or a response violates an invariant established by protocol validation.
Sourcepub fn left_join_global<GK, VG, VR, KM, J, GKS, VGS>(
&self,
global: &GlobalKTable<GK, VG, GKS, VGS>,
key_mapper: KM,
joiner: J,
) -> KStream<K, VR, KS, <VR as DefaultSerde>::Serde>
pub fn left_join_global<GK, VG, VR, KM, J, GKS, VGS>( &self, global: &GlobalKTable<GK, VG, GKS, VGS>, key_mapper: KM, joiner: J, ) -> KStream<K, VR, KS, <VR as DefaultSerde>::Serde>
leftJoin (left stream-globaltable join): like
join_global but always forwards a record for every
stream record. On a global-store miss the joiner receives None for the
global-side value.
Sourcepub fn join<V2, VO, F, V2S>(
&self,
other: &KStream<K, V2, KS, V2S>,
joiner: F,
windows: JoinWindows,
stream_joined: StreamJoined<KS, VS, V2S>,
) -> KStream<K, VO, KS, <VO as DefaultSerde>::Serde>
pub fn join<V2, VO, F, V2S>( &self, other: &KStream<K, V2, KS, V2S>, joiner: F, windows: JoinWindows, stream_joined: StreamJoined<KS, VS, V2S>, ) -> KStream<K, VO, KS, <VO as DefaultSerde>::Serde>
join (windowed inner stream-stream join): match records over a window.
For each record on either stream, the join puts the record into its own
JoinWindowStore and fetches the OTHER stream’s store over the join
window. It forwards one output per match, keyed by the same key. A left
record at t matches right records with a timestamp in
[t - before, t + after]. The rule is symmetric: the per-side OTHER
processor swaps before and after, so the rule holds whichever side
drives the record.
The join lowers to a THIS processor fed by this stream, an OTHER
processor fed by other, and a MERGE node that unions the two
outputs. This mirrors KTable::join’s dual+merge shape. Each side puts
into its own retainDuplicates join-window store and reads the other
side’s store. Each side connects to BOTH stores, so the grouping pass
folds A, B, both stores, and the two join nodes into one copartitioned
subtopology. When both streams are single-source-topic streams, the join
declares their source topics as a copartition group (KIP-1071).
Both stream keys must be unchanged relative to their source partitioning.
You must call repartition() after a key-changing op upstream. If you do
not, the join panics.
§Naming vs the JVM
The JVM overloads join for stream-table and stream-stream. Rust cannot, so
the windowed stream-stream join keeps join/left_join while the
stream-table forms are join_table/
left_join_table.
§Panics
Panics if synchronized client state is poisoned or a response violates an invariant established by protocol validation.
Sourcepub fn left_join<V2, VO, F, V2S>(
&self,
other: &KStream<K, V2, KS, V2S>,
joiner: F,
windows: JoinWindows,
stream_joined: StreamJoined<KS, VS, V2S>,
) -> KStream<K, VO, KS, <VO as DefaultSerde>::Serde>
pub fn left_join<V2, VO, F, V2S>( &self, other: &KStream<K, V2, KS, V2S>, joiner: F, windows: JoinWindows, stream_joined: StreamJoined<KS, VS, V2S>, ) -> KStream<K, VO, KS, <VO as DefaultSerde>::Serde>
leftJoin (windowed left stream-stream join): emit unmatched left records.
Every record on THIS (left) stream that finds no match in the OTHER
(right) window emits joiner(&this, None) once that record’s window
closes. Stream time drives the window close (KIP-633). Matched records
emit joiner(&this, Some(&other)), as in the inner join. The right side
never emits a non-join.
§Panics
Panics if synchronized client state is poisoned or a response violates an invariant established by protocol validation.
Sourcepub fn outer_join<V2, VO, F, V2S>(
&self,
other: &KStream<K, V2, KS, V2S>,
joiner: F,
windows: JoinWindows,
stream_joined: StreamJoined<KS, VS, V2S>,
) -> KStream<K, VO, KS, <VO as DefaultSerde>::Serde>
pub fn outer_join<V2, VO, F, V2S>( &self, other: &KStream<K, V2, KS, V2S>, joiner: F, windows: JoinWindows, stream_joined: StreamJoined<KS, VS, V2S>, ) -> KStream<K, VO, KS, <VO as DefaultSerde>::Serde>
outerJoin (windowed outer stream-stream join): emit from either side.
Every record on EITHER side that finds no match emits
joiner(Some, None) or joiner(None, Some) once its window closes
(KIP-633). Matched records emit joiner(Some, Some).
Sourcepub fn repartition<KS2, VS2>(
&self,
repartitioned: Repartitioned<KS2, VS2>,
) -> KStream<K, V, KS2, VS2>
pub fn repartition<KS2, VS2>( &self, repartitioned: Repartitioned<KS2, VS2>, ) -> KStream<K, V, KS2, VS2>
repartition: force a repartition through an internal topic.
This op lowers as sink → add_repartition_topic → source. It is the same
pattern that the implicit repartition before a stateful aggregation uses.
The repartition topic name is <app_id>-<name>-repartition. <name> is
the explicit Repartitioned name when
set, otherwise an auto-name minted from the counter.
Byte-exactness vs JVM: the JVM assigns a distinct
KSTREAM-REPARTITION- counter for standalone repartition() calls. No
golden fixture validates that counter. The bar here is functional
correctness: no panic, and records flow through.
Sourcepub fn split(&self) -> BranchedStream<K, V, KS, VS>
pub fn split(&self) -> BranchedStream<K, V, KS, VS>
split: begin a branching fan-out.
Returns a BranchedStream builder. Individual
branch calls on that builder create filtered
child streams. The split itself adds no node to the topology. Each
branch call creates a filter-backed child wired directly to this
stream’s node.
Simplification vs JVM: each branch receives a record when its predicate matches, not just the first matching branch. For mutually-exclusive predicates the behaviour is identical to the JVM first-match-wins semantics.
Sourcepub fn group_by_key_explicit<GKS, GVS>(
&self,
grouped: impl Into<Grouped<GKS, GVS>>,
) -> KGroupedStream<K, V>
pub fn group_by_key_explicit<GKS, GVS>( &self, grouped: impl Into<Grouped<GKS, GVS>>, ) -> KGroupedStream<K, V>
groupByKey: group by the existing key, ready for an aggregation.
This op records no graph node. A terminal count, reduce, or
aggregate call records the optional repartition and the aggregate node.
The returned KGroupedStream carries two things: whether the upstream
key lineage is key-changing, which forces the aggregation to insert a
repartition, and a typed repartition-lowering thunk built from the
Grouped serdes.
Sourcepub fn group_by_key(&self) -> KGroupedStream<K, V>
pub fn group_by_key(&self) -> KGroupedStream<K, V>
groupByKey using the stream’s existing serdes.
Sourcepub fn group_by<GKS, GVS, F>(
&self,
f: F,
grouped: impl Into<Grouped<GKS, GVS>>,
) -> KGroupedStream<GKS::Target, V>
pub fn group_by<GKS, GVS, F>( &self, f: F, grouped: impl Into<Grouped<GKS, GVS>>, ) -> KGroupedStream<GKS::Target, V>
groupBy: re-key with f, then group by the new key.
This op is equivalent to select_key(f).group_by_key_explicit(grouped).
The key change forces a repartition before any later aggregation.
Sourcepub fn process<KOut, VOut, PS>(
&self,
supplier: PS,
store_names: impl IntoIterator<Item = impl Into<String>>,
) -> KStream<KOut, VOut, <KOut as DefaultSerde>::Serde, <VOut as DefaultSerde>::Serde>where
KOut: DefaultSerde + Any + Send + Sync + Clone,
VOut: DefaultSerde + Any + Send + Clone,
PS: ProcessorSupplier<K, V, KOut, VOut> + Clone + 'static,
pub fn process<KOut, VOut, PS>(
&self,
supplier: PS,
store_names: impl IntoIterator<Item = impl Into<String>>,
) -> KStream<KOut, VOut, <KOut as DefaultSerde>::Serde, <VOut as DefaultSerde>::Serde>where
KOut: DefaultSerde + Any + Send + Sync + Clone,
VOut: DefaultSerde + Any + Send + Clone,
PS: ProcessorSupplier<K, V, KOut, VOut> + Clone + 'static,
process: attach a custom Processor-API node that may rewrite the key.
supplier is any user ProcessorSupplier, for example a || MyProc
closure. store_names names the stores that
StreamsBuilder::add_state_store registered and that the processor
reads and writes through ProcessorContext::get_state_store. This
method looks up each named store’s connect thunk now, so you must add
the store before this call. Lowering then invokes each thunk to register
the store, emit its compact <app>-<store>-changelog changelog, and
connect the store to this processor node.
This op mirrors the JVM KStream.process. It treats the result as
key-changing, because the processor may call forward with any key.
The single-source-topic lineage therefore breaks, and a downstream
aggregation or join must repartition first.
§Panics
Panics if any name in store_names was not registered through
add_state_store.
Sourcepub fn process_values<VOut, PS>(
&self,
supplier: PS,
store_names: impl IntoIterator<Item = impl Into<String>>,
) -> KStream<K, VOut, KS, <VOut as DefaultSerde>::Serde>where
VOut: DefaultSerde + Any + Send + Clone,
PS: FixedKeyProcessorSupplier<K, V, VOut> + Clone + 'static,
pub fn process_values<VOut, PS>(
&self,
supplier: PS,
store_names: impl IntoIterator<Item = impl Into<String>>,
) -> KStream<K, VOut, KS, <VOut as DefaultSerde>::Serde>where
VOut: DefaultSerde + Any + Send + Clone,
PS: FixedKeyProcessorSupplier<K, V, VOut> + Clone + 'static,
processValues: attach a custom fixed-key Processor-API node (KIP-820).
The node may rewrite the value but NOT the key.
supplier is any FixedKeyProcessorSupplier, for example a
|| MyFixedProc closure. store_names names the stores that
add_state_store registered and that the processor reads and writes
through FixedKeyProcessorContext::get_state_store. As with
process, this method looks up each named store’s
connect thunk now, so you must add the store before this call.
Lowering then invokes each thunk to register the store, emit its compact
<app>-<store>-changelog changelog, and connect the store to this
processor node.
Unlike process, this op keeps the key. The result is
therefore non-key-changing and carries the single-source-topic lineage
unchanged, so a downstream aggregation or join needs no repartition. An
internal adapter wraps the supplier, so the runtime sees a
Processor<K, V, K, VOut>.
§Panics
Panics if any name in store_names was not registered through
add_state_store.
Sourcepub fn to_table_explicit<NKS, NVS>(
&self,
materialized: impl Into<Materialized<NKS, NVS>>,
) -> KTable<K, V, NKS, NVS>
pub fn to_table_explicit<NKS, NVS>( &self, materialized: impl Into<Materialized<NKS, NVS>>, ) -> KTable<K, V, NKS, NVS>
toTable: materialize this stream into a KTable.
The op writes each record into a state store and forwards a Change<V>
change-stream that carries the prior store value as old.
to_table carries the key through unchanged, so it never inserts a
repartition. The JVM repartitions only when the upstream key is rewritten
without a re-group. The store name is Materialized’s explicit name when
set, otherwise a fresh KSTREAM-TOTABLE-STATE-STORE- counter. The store
gets the standard <app>-<store>-changelog changelog, or no changelog
when Materialized::with_logging(false).
Auto Trait Implementations§
impl<K, V, KS = <K as DefaultSerde>::Serde, VS = <V as DefaultSerde>::Serde> !RefUnwindSafe for KStream<K, V, KS, VS>
impl<K, V, KS = <K as DefaultSerde>::Serde, VS = <V as DefaultSerde>::Serde> !Send for KStream<K, V, KS, VS>
impl<K, V, KS = <K as DefaultSerde>::Serde, VS = <V as DefaultSerde>::Serde> !Sync for KStream<K, V, KS, VS>
impl<K, V, KS = <K as DefaultSerde>::Serde, VS = <V as DefaultSerde>::Serde> !UnwindSafe for KStream<K, V, KS, VS>
impl<K, V, KS, VS> Freeze for KStream<K, V, KS, VS>
impl<K, V, KS, VS> Unpin for KStream<K, V, KS, VS>
impl<K, V, KS, VS> UnsafeUnpin for KStream<K, V, KS, VS>where
KS: UnsafeUnpin,
VS: UnsafeUnpin,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> 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 more§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§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();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§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();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§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();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§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();§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.
§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);