Skip to main content

MetadataImage

Struct MetadataImage 

Source
pub struct MetadataImage { /* private fields */ }

Implementations§

Source§

impl MetadataImage

Source

pub fn new(cluster_id: Uuid) -> Self

Source

pub fn cluster_id(&self) -> Uuid

Source

pub fn topics(&self) -> impl Iterator<Item = &TopicRecord>

Source

pub fn topic(&self, name: &str) -> Option<&TopicRecord>

Source

pub fn topic_by_id(&self, id: &Uuid) -> Option<&TopicRecord>

KIP-516: resolve a topic by its UUID. O(1) through the topic_ids index.

Source

pub fn topic_name_by_id(&self, id: &Uuid) -> Option<&str>

KIP-516: resolve a topic name by its UUID.

Source

pub fn partition(&self, topic: &str, idx: i32) -> Option<&PartitionRecord>

Source

pub fn partitions_of( &self, topic: &str, ) -> impl Iterator<Item = &PartitionRecord>

All partitions of topic, in ascending partition-index order. The by-topic index gives an O(1) topic lookup and an O(own partitions) iteration. The method never scans the partitions of other topics, so a per-topic caller stays proportional to the topic it asks about, even in images with tens of thousands of topics.

Source

pub fn partition_next_offset(&self, topic: &str, partition: i32) -> Option<i64>

The committed next-offset for a diskless partition, if any advance has been applied.

Source

pub fn partition_elr( &self, topic: &str, partition: i32, ) -> (&[NodeId], &[NodeId])

Source

pub fn leader_recovery_state( &self, topic: &str, partition: i32, ) -> LeaderRecoveryState

Source

pub fn topic_partition_count(&self, topic: &str) -> i32

The live partition count for topic, derived from the partitions map and not from the stored TopicRecord.partitions field. This is the authoritative count for the KIP-631 round-trip, because the KIP-631 TopicRecord carries no partition count. It is also the authoritative count for the validate partition-count-grew check. Returns 0 for an unknown topic, or for a topic with no applied partition records. O(1).

Source

pub fn all_partitions(&self) -> impl Iterator<Item = &PartitionRecord>

Single-pass iterator over every partition in the image. Each record carries its own topic and partition fields. Topic order is unspecified. Within a topic the order is ascending partition index. The iterator is O(P) in total partition count. The cluster-wide maintenance loops for failover, rebalance, reassignment, and metrics use this instead of a per-topic loop.

Source

pub fn reassignments_in_flight( &self, ) -> impl Iterator<Item = &PartitionRecord> + '_

All partitions where a reassignment is currently in flight, that is, where adding_replicas or removing_replicas is non-empty.

Source

pub fn topic_config(&self, topic: &str) -> Option<&BTreeMap<String, String>>

Currently-effective config overrides for topic, or None if no V1TopicConfig record has applied for this topic since the last V1DeleteTopic, or since image creation.

Source

pub fn broker_config( &self, node_id: NodeId, ) -> Option<&BTreeMap<String, String>>

Per-broker config overrides for node_id, or None if no V1BrokerConfig record has been applied for this broker.

Source

pub fn default_broker_config(&self) -> Option<&BTreeMap<String, String>>

Cluster-wide dynamic broker-config defaults, or None when no default broker config has been applied.

Source

pub fn broker_throttle_rate( &self, node_id: NodeId, kind: ThrottleKind, ) -> Option<ByteRate>

Returns the KIP-73 throttle rate for node_id and kind. Returns None if the config key is absent, unparseable, or negative. -1 is Kafka’s convention for “disabled” or “unlimited”.

Source

pub fn client_metrics_config( &self, name: &str, ) -> Option<&BTreeMap<String, String>>

Override map for a single KIP-714 client-metrics subscription.

Source

pub fn client_metrics_subscriptions( &self, ) -> impl Iterator<Item = (&String, &BTreeMap<String, String>)>

All configured client-metrics subscriptions, (name, overrides).

Source

pub fn group_config(&self, group_id: &str) -> Option<&BTreeMap<String, String>>

Dynamic KIP-1071 overrides for one GROUP config resource.

Source

pub fn group_configs( &self, ) -> impl Iterator<Item = (&String, &BTreeMap<String, String>)>

All configured GROUP resources.

Source

pub fn client_quotas(&self) -> &HashMap<EntityKey, BTreeMap<String, f64>>

Source

pub fn scram_credential( &self, user: &str, mechanism: SaslMechanism, ) -> Option<&ScramCredential>

Source

pub fn scram_credentials_users(&self) -> Vec<String>

All distinct users with at least one SCRAM credential. Order is unspecified.

Source

pub fn scram_credentials_for_user( &self, user: &str, ) -> Vec<(SaslMechanism, u32)>

All (mechanism, iterations) pairs for user. Empty if user has no SCRAM credentials. Order is unspecified.

Source

pub fn broker(&self, node_id: NodeId) -> Option<&BrokerRegistrationRecord>

Source

pub fn controller( &self, node_id: NodeId, ) -> Option<&ControllerRegistrationRecord>

Source

pub fn broker_epoch(&self, node_id: NodeId) -> Option<i64>

KIP-903: the broker epoch (registration commit offset) for node_id, or None if the broker is not registered in this image.

Source

pub fn next_producer_id(&self) -> i64

First producer ID not covered by any committed allocation block.

Source

pub fn brokers(&self) -> impl Iterator<Item = &BrokerRegistrationRecord>

Source

pub fn controllers(&self) -> impl Iterator<Item = &ControllerRegistrationRecord>

Source

pub fn kraft_version(&self) -> u16

Source

pub fn voters(&self) -> &VoterSet

Source

pub fn matching_acls<'a>( &'a self, rt: ResourceType, rn: &'a str, ) -> impl Iterator<Item = &'a AclEntry> + 'a

Iterate every ACL that could possibly match (rt, rn):

  • all literal entries at (rt, rn)
  • all literal entries at (rt, "*"), the WILDCARD_RESOURCE, which matches every resource of that type. See Kafka’s AclAuthorizer and StandardAuthorizer. This is what kafka-acls --topic '*' produces.
  • all prefixed entries whose resource_name is a prefix of rn
Source

pub fn all_acls(&self) -> impl Iterator<Item = &AclEntry>

All ACL entries, both literal and prefixed, across all resource types. DescribeAcls uses this.

Source

pub fn topic_freeze(&self, topic: &str) -> Option<&TopicFreezeRecord>

The write-freeze entry that covers topic, or None when the topic accepts writes (KFC-9).

A cluster with no freeze costs two is_empty tests, because the produce path calls this once per topic per request. A literal entry beats every prefix entry, and the longest matching prefix wins among the prefix entries.

An internal topic is never frozen. The __ name convention is the test, so a prefix scope of "" or "_" cannot take __consumer_offsets down with the rest of the cluster.

Source

pub fn topic_freezes(&self) -> impl Iterator<Item = &TopicFreezeRecord>

Every live write-freeze entry, literal and prefixed (KFC-9). A thawed entry is removed on apply, so every entry here has frozen: true. Order is unspecified.

Source

pub fn break_glass_proposal( &self, id: Uuid, ) -> Option<&BreakGlassProposalRecord>

Look up a break-glass proposal by its id (KFC-9).

Source

pub fn break_glass_proposals( &self, ) -> impl Iterator<Item = &BreakGlassProposalRecord>

Every break-glass proposal still in the image (KFC-9), including the consumed and withdrawn ones that the expiry sweep has not yet removed. Order is unspecified.

Source

pub fn delegation_token_by_id(&self, token_id: &str) -> Option<&DelegationToken>

Look up a delegation token by its token_id (KIP-48).

Source

pub fn delegation_tokens_by_owner( &self, owner: &KafkaPrincipal, ) -> Vec<&DelegationToken>

All tokens owned by owner (KIP-48). The match on the owning KafkaPrincipal is exact. Order is unspecified.

Source

pub fn delegation_tokens_visible_to( &self, principal: &KafkaPrincipal, ) -> Vec<&DelegationToken>

Tokens that principal may see through DescribeDelegationToken without DescribeToken permission: those it owns, created or may renew (DelegationToken::owner_or_renewer). Order is unspecified.

Source

pub fn all_delegation_tokens(&self) -> impl Iterator<Item = &DelegationToken>

Every delegation token currently in the image (KIP-48). DescribeDelegationToken uses this for callers with DescribeToken permission on the cluster.

Source

pub fn delegation_token_by_hmac( &self, secret_key: &[u8], hmac: &[u8], ) -> Option<&DelegationToken>

KIP-48: the delegation token whose HMAC under secret_key is hmac.

RenewDelegationToken and ExpireDelegationToken identify a token by HMAC on the wire and not by token_id. The image keeps no HMAC, as Kafka’s metadata does not, so each token’s HMAC is recomputed with krabka_security::compute_token_hmac. The scan is linear over the small in-memory token map.

Source

pub fn finalized_features(&self) -> &BTreeMap<String, i16>

KIP-584: finalized feature levels, keyed by feature name. Empty until an UpdateFeatures call lands a V1FeatureLevel record.

Source

pub fn finalized_features_epoch(&self) -> i64

KIP-584 finalized-features epoch. -1 (“unknown”) until the first feature is finalized.

Source

pub fn finalized_metadata_version(&self) -> Option<i16>

The finalized metadata.version level, or None if no V1FeatureLevel for metadata.version has applied. That is a pre-bootstrap or legacy image, which is MetadataVersion.UNKNOWN.

Source

pub fn finalized_feature(&self, name: &str) -> Option<i16>

KIP-584: the finalized level for an arbitrary feature, or None if it has not been finalized. Generic counterpart to Self::finalized_metadata_version.

Source

pub fn min_required_metadata_version(&self) -> i16

The minimum metadata.version level that the live image needs: the floor that a downgrade must not drop below. It rises with feature-gated state present in the image: KRaft SCRAM creds, delegation tokens, and KIP-1276 CIDR ACL hosts. The baseline is METADATA_VERSION_MIN.

Source

pub fn metadata_version_downgrade_records( &self, target: i16, ) -> Vec<MetadataRecord>

Metadata removals needed to materialize this image at target. An empty result means the downgrade is lossless. The controller emits these records before the trailing metadata.version feature record only for an explicitly unsafe downgrade.

Source

pub fn apply(&mut self, rec: &MetadataRecord)

Apply one record. Returns the previous record, for V1Topic and V1BrokerRegistration, so the caller can observe overwrite cases. The method is infallible. The controller pre-validates against the current image before it submits to Raft. Apply must never fail on a committed entry.

Source

pub fn to_records(&self) -> Vec<MetadataRecord>

Serialize the image into the minimal sequence of MetadataRecords whose in-order apply reproduces this image exactly. This is the inverse of apply over a sequence of non-tombstone records: each stored entry maps to the record that would create it.

The method deliberately never emits tombstone or removal records: V1DeleteTopic, V1DeleteScramCredential, V1DeleteAccessControlEntry, V1DeleteDelegationToken, and V1UnregisterBroker. A snapshot captures resulting state, not deletion history. V1BrokerConfig deletes vanish in the same way. The method emits only the surviving key and value pairs, as Some(value) sets.

The method emits records in dependency order, so a fresh image that applys them never sees a dangling reference: brokers, broker-configs, topics, partitions, topic-configs, SCRAM creds, ACLs, client quotas, delegation tokens.

Source

pub fn from_records(cluster_id: Uuid, records: &[MetadataRecord]) -> Self

Reconstruct an image from a cluster_id and a record sequence, typically the output of Self::to_records read back from a snapshot. The method news an empty image and applys each record in order.

Source

pub fn validate(&self, rec: &MetadataRecord) -> Result<(), MetadataError>

Synchronous pre-validation: returns Ok if the record would be a no-conflict apply, otherwise the appropriate error. Controller::submit_change uses this before it forwards to openraft.

§Errors

Returns the conflict that would prevent the record from being applied.

Trait Implementations§

Source§

impl Clone for MetadataImage

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MetadataImage

Source§

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

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

impl Default for MetadataImage

Source§

fn default() -> Self

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

impl PartialEq for MetadataImage

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MetadataImage

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

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

Source§

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

Source§

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

Source§

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

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

Source§

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

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> Paint for T
where T: ?Sized,

Source§

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 primary(&self) -> Painted<&T>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 bold(&self) -> Painted<&T>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 mask(&self) -> Painted<&T>

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

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

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

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

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

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

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

§Example
println!("{}", value.linger());
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.

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

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

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

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

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

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

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

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

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

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

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

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

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

Create a new Painted with a default Style. Read more
Source§

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

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

Source§

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

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

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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