Skip to main content

Intent

Struct Intent 

Source
pub struct Intent {
    pub nix: Option<NixIntent>,
    pub flux: Option<FluxIntent>,
    pub lisp: Option<LispIntent>,
    pub container: Option<ContainerIntent>,
    pub aplicacao: Option<AplicacaoIntent>,
    pub guest: Option<GuestIntent>,
}
Expand description

Intent — exactly one variant should be populated.

Fields§

§nix: Option<NixIntent>§flux: Option<FluxIntent>§lisp: Option<LispIntent>§container: Option<ContainerIntent>§aplicacao: Option<AplicacaoIntent>§guest: Option<GuestIntent>

Implementations§

Source§

impl Intent

Source

pub fn variant(&self) -> Result<IntentVariant<'_>, IntentError>

Resolve to exactly one variant. Errors on zero or many.

One-line inherent forwarder that delegates the sweep body to the substrate primitive crate::tagged_union::TaggedUnion::variant — every production .variant() site on ProcessSpec dispatches through this ONE default body so the resolve-sweep pattern lives at ONE substrate site. The inherent surface stays load-bearing so consumer callsites don’t need use TaggedUnion.

Source

pub fn has(&self, kind: IntentKind) -> bool

Presence probe — does this tagged union carry a populated slot addressed by the given closed-set discriminator?

One-line inherent forwarder that delegates to the substrate primitive crate::tagged_union::TaggedUnion::has — every closed-set-driven presence check on ProcessSpec dispatches through this ONE default body so the per-slot spec.<field>.is_some() pattern lives at ONE substrate site. The inherent surface stays load-bearing so consumer callsites don’t need use TaggedUnion.

Source

pub fn find(&self, kind: IntentKind) -> Option<IntentVariant<'_>>

Widened peer of Self::has — returns the borrowed variant view addressed by kind, or None when the matching slot is empty.

One-line inherent forwarder that delegates to the substrate primitive crate::tagged_union::TaggedUnion::find, whose default body is kind.select(self). Every closed-set-driven kind.select(&parent) callsite that pre-lift required use VariantSelector at the caller now reads parent.find(kind) through the inherent surface, byte-for-byte symmetrical with parent.has(kind). The composition law parent.has(kind) == parent.find(kind).is_some() is pinned as a first-class typed invariant by the trait’s own has default body (self.find(kind).is_some()), swept substrate-wide by crate::tagged_union::assert_find_agrees_with_has.

Source

pub fn populated_kinds(&self) -> Vec<IntentKind>

Closed-set-inversion peer of Self::has / Self::find — returns the canonical-ordered Vec of populated ClosedSet::ALL discriminators.

One-line inherent forwarder that delegates to the substrate primitive crate::tagged_union::TaggedUnion::populated_kinds, whose default body is <Kind as ClosedSet>::ALL.iter().copied().filter(|k| self.has(*k)).collect(). Every consumer that needs to enumerate which slots on a tagged-union parent are populated (an operator-facing “Ambiguous named [Nix, Container]” diagnostic composed on the malformed arm; a closed-set audit dispatcher; a populated-kind-count-<n> require-tag classifier prefix) reads parent.populated_kinds() through the inherent surface, byte-for-byte symmetrical with parent.has(kind) / parent.find(kind). The composition law parent.populated_kinds().contains(&k) == parent.has(k) is pinned as a first-class typed invariant by the trait’s own default body and swept substrate-wide by crate::tagged_union::assert_populated_kinds_matches_has.

Source

pub fn populated_kind_count(&self) -> usize

Scalar cardinality peer of Self::populated_kinds — the number of populated slots on this tagged union.

One-line inherent forwarder that delegates to the substrate primitive crate::tagged_union::TaggedUnion::populated_kind_count, whose default body is <Kind as ClosedSet>::ALL.iter().copied().filter(|k| self.has(*k)).count(). Every consumer that needs the cardinality of the populated-slot set as a scalar (a populated-kind-count-<n> require-tag classifier prefix; a fast-path branch on the Ambiguous-arm side that discriminates “well-formed” from “malformed with N slots”; a coherence check that verifies “every well-formed parent has exactly one populated slot”) reads parent.populated_kind_count() through the inherent surface, byte-for-byte symmetrical with parent.has(kind) / parent.find(kind) / parent.populated_kinds(). The composition law parent.populated_kind_count() == parent.populated_kinds().len() is pinned as a first-class typed invariant by the trait’s own default body and swept substrate-wide by crate::tagged_union::assert_populated_kind_count_matches_populated_kinds.

Source

pub fn missing_kinds(&self) -> Vec<IntentKind>

Closed-set-COMPLEMENT peer of Self::populated_kinds — returns the canonical-ordered Vec of EMPTY ClosedSet::ALL discriminators.

One-line inherent forwarder that delegates to the substrate primitive crate::tagged_union::TaggedUnion::missing_kinds, whose default body is <Kind as ClosedSet>::ALL.iter().copied().filter(|k| !self.has(*k)).collect(). Every consumer that needs to enumerate which slots on a tagged-union parent are ABSENT (an operator-facing “still missing [Nix, Container]” diagnostic on the partially-populated arm; a coherence check verifying “every process boundary carries every intent slot”; a missing-<kind> require-tag classifier arm) reads parent.missing_kinds() through the inherent surface, byte-for-byte symmetrical with parent.populated_kinds(). The partition law parent.populated_kinds() ∪ parent.missing_kinds() == ClosedSet::ALL (with the two sets disjoint) is pinned as a first-class typed invariant by the trait’s own default body and swept substrate-wide by crate::tagged_union::assert_missing_kinds_matches_has.

Source

pub fn missing_kind_count(&self) -> usize

Scalar cardinality peer of Self::missing_kinds — the number of EMPTY slots on this tagged union.

One-line inherent forwarder that delegates to the substrate primitive crate::tagged_union::TaggedUnion::missing_kind_count, whose default body is <Kind as ClosedSet>::ALL.iter().copied().filter(|k| !self.has(*k)).count(). Every consumer that needs the cardinality of the missing-slot set as a scalar (a missing-kind-count-<n> require-tag classifier prefix; a fast-path branch that discriminates “well-formed” from “N missing slots”; a coherence check that verifies “every well-formed parent has exactly ALL.len() - 1 missing slots”) reads parent.missing_kind_count() through the inherent surface, byte-for-byte symmetrical with parent.populated_kind_count(). The scalar partition law parent.populated_kind_count() + parent.missing_kind_count() == <Kind as ClosedSet>::ALL.len() is pinned by the trait’s own default body and swept substrate-wide by crate::tagged_union::assert_missing_kind_count_matches_missing_kinds.

Source

pub fn first_populated_kind(&self) -> Option<IntentKind>

Short-circuiting Option<$kind> peer of Self::populated_kinds — the FIRST populated kind on this tagged union in canonical ClosedSet::ALL order, or None when no slot is populated.

One-line inherent forwarder that delegates to the substrate primitive crate::tagged_union::TaggedUnion::first_populated_kind, whose default body is <Kind as ClosedSet>::ALL.iter().copied().find(|k| self.has(*k)). Every consumer that needs the earliest populated slot on a tagged-union parent as an Option<Kind> (an operator-facing “Ambiguous, starting at Nix” diagnostic on the malformed arm; a first-populated-<kind> require-tag classifier arm; a fast-path branch that discriminates “empty” from “any populated”) reads parent.first_populated_kind() through the inherent surface, byte-for-byte symmetrical with parent.populated_kinds() / parent.has(kind). The composition law parent.first_populated_kind() == parent.populated_kinds().first().copied() is pinned as a first-class typed invariant by the trait’s own default body and swept substrate-wide by crate::tagged_union::assert_first_populated_kind_matches_populated_kinds.

Source

pub fn first_missing_kind(&self) -> Option<IntentKind>

Short-circuiting Option<$kind> peer of Self::missing_kinds — the FIRST missing kind on this tagged union in canonical ClosedSet::ALL order, or None when EVERY slot is populated.

One-line inherent forwarder that delegates to the substrate primitive crate::tagged_union::TaggedUnion::first_missing_kind, whose default body is <Kind as ClosedSet>::ALL.iter().copied().find(|k| !self.has(*k)). Byte-for-byte symmetrical with parent.first_populated_kind() under a negated predicate; the two primitives PARTITION ClosedSet::ALL’s earliest-element projection on the (populated, missing) split. The composition law parent.first_missing_kind() == parent.missing_kinds().first().copied() is pinned as a first-class typed invariant by the trait’s own default body and swept substrate-wide by crate::tagged_union::assert_first_missing_kind_matches_missing_kinds.

Source§

impl Intent

Source

pub fn has_workload_kind(&self, kind: WorkloadKind) -> bool

Presence probe over the container-intent workload-kind axis — true iff the IntentKind::Container slot is populated AND its ContainerIntent::workload_kind equals kind.

§Peer to Intent::has on a different composition axis

Intent::has (macro-generated via crate::declare_tagged_union_impls!) addresses the outer closed set IntentKind — “which of the six tagged-union slots is populated”. This method addresses a nested closed set WorkloadKind living on the required ContainerIntent::workload_kind field inside the optional Intent::container slot — “given that the intent IS a container, which K8s workload kind (Deployment / StatefulSet / DaemonSet / Job / CronJob) does it render into”. The two axes are orthogonal: an operator can ask both intent-container (this intent variant is a container) AND workload-kind-Job (specifically a Job-shaped container) against the SAME [ProcessSpec], and each answers independently. Every non-Container intent variant returns false for every WorkloadKind here — the Option-hop through self.container gates the inner scalar comparison so a Nix / Flux / Lisp / Aplicacao / Guest intent has no workload-kind axis to inhabit.

§Fresh (Required-parent × Option-variant-inner × required-scalar-child) corner

The presence-probe algebra the workspace publishes across tatara-process spans a (parent-shape × child-shape) taxonomy. Prior probes cover:

This probe opens a FRESH corner: (Required-parent × Option-variant-inner × required-scalar-child). The parent Intent is required on crate::crd::ProcessSpec; the Intent::container slot is an Option<ContainerIntent>; the ContainerIntent::workload_kind field is a required scalar. No prior family reaches THROUGH one specific slot of a required-parent tagged-union to a scalar field on that slot’s payload; every other tagged-union walk addresses the variant itself. A future co-tenant on the same corner — a hypothetical spec.intent.aplicacao_profile_family() probing AplicacaoIntent::profile’s canonicalized family, a spec.intent.lisp_dialect() probing LispIntent::reader against a closed set of registered dialects — lands as one more inherent method here with the same self.<variant>.as_ref().is_some_and(|v| v.<field> == kind) three-step shape.

§Compounding

The workload-kind-<kind> require-tag prefix family in tatara-reconciler::bin::tatara-check::evaluate_point_require_tag composes this primitive with the closed-set WorkloadKind’s autoderived FromStr through the strip_and_classify_prefixed_kind substrate to publish the TWENTY-FIRST closed-set-driven prefix family byte-for-byte symmetrical with the twenty peer families rooted at their own has_<field> primitives.

A future sixth WorkloadKind variant added to ALL (a hypothetical ReplicaSet for pre-Deployment replica-set direct emission, or a Pod for singleton naked-pod containers) reaches this probe through ONE ALL entry + one as_str arm + one api_version arm + one is_batch arm with no per-caller edit at the require-tag classifier and no per-consumer restatement of the self.container.as_ref().is_some_and(|c| c.workload_kind == kind) closure body.

§Theory

THEORY.md §II.1 invariant 5 — composition preserves proofs; the per-container workload_kind comparison lives at ONE substrate site so every downstream (require-tag classifier, coherence check, editor completion, future workload-kind- driven audit dispatcher) binds through the SAME has_workload_kind(kind) shape rather than restating the spec.intent.container.as_ref().is_some_and(...) closure body at each callsite. THEORY.md §VI.1 — generation over composition; a future WorkloadKind variant lands at ONE ALL entry + one as_str arm on the closed set and the presence probe picks it up mechanically without further per-consumer edits.

Trait Implementations§

Source§

impl Clone for Intent

Source§

fn clone(&self) -> Intent

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 Intent

Source§

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

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

impl Default for Intent

Source§

fn default() -> Intent

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

impl<'de> Deserialize<'de> for Intent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for Intent

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for Intent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TaggedUnion for Intent

Source§

const KIND_LIST: &'static str = INTENT_KIND_LIST

Slash-joined operator diagnostic literal — the payload of TaggedUnionError::empty when no slot is populated on this tagged union. Pinned against <Self::Kind as tatara_closed_set::ClosedSet>::labels_joined("/") by assert_kind_list_matches_closed_set so a variant added to Self::Kind without updating this constant (or a renamed variant) fails-loudly at the testkit boundary.
Source§

type Kind = IntentKind

The closed-set discriminator over this tagged-union’s variants. Bound to tatara_closed_set::ClosedSet so the generic diagnostic-stability testkit (assert_kind_list_matches_closed_set) can project <Self::Kind as ClosedSet>::labels_joined("/") against Self::KIND_LIST byte-identically. Additionally bound to VariantSelector<Self> so Self::variant’s default body can dispatch k.select(self) at each [ClosedSet::ALL] entry generically.
Source§

type Error = IntentError

The typed error carrier returned by the parent’s inherent .variant() method — projects onto the shared TaggedUnionError contract so resolve_or_err’s two-arm dispatch reaches every implementor uniformly.
Source§

fn variant( &self, ) -> Result<<Self::Kind as VariantSelector<Self>>::Variant<'_>, Self::Error>

Sweep over every Self::Kind discriminator in ClosedSet::ALL order, projecting each into the parent’s borrowed variant view via VariantSelector::select, and resolve to exactly one populated variant through resolve_or_err. Errors on zero (with Self::KIND_LIST carried on the TaggedUnionError::empty arm) or many. Read more
Source§

fn find( &self, kind: Self::Kind, ) -> Option<<Self::Kind as VariantSelector<Self>>::Variant<'_>>

Widened peer of Self::has — projects a &'a Self borrow into the optional borrowed-variant view addressed by kind, or None when the matching slot on Self is empty. Read more
Source§

fn has(&self, kind: Self::Kind) -> bool

Presence probe — does this tagged union carry a populated slot addressed by the given closed-set discriminator? Read more
Source§

fn populated_kinds(&self) -> Vec<Self::Kind>

Closed-set-inversion refinement — enumerate the set of Self::Kind discriminators whose corresponding slot on self is populated, in canonical ClosedSet::ALL order. Read more
Source§

fn populated_kind_count(&self) -> usize

Scalar cardinality refinement on the closed-set-inversion axis — the number of Self::Kind discriminators whose corresponding slot on self is populated. Read more
Source§

fn missing_kinds(&self) -> Vec<Self::Kind>

Closed-set-COMPLEMENT refinement — enumerate the set of Self::Kind discriminators whose corresponding slot on self is EMPTY, in canonical ClosedSet::ALL order. Read more
Source§

fn missing_kind_count(&self) -> usize

Scalar cardinality refinement on the closed-set-complement axis — the number of Self::Kind discriminators whose corresponding slot on self is EMPTY. Read more
Source§

fn first_populated_kind(&self) -> Option<Self::Kind>

Short-circuiting Option<Self::Kind> peer of Self::populated_kinds — the FIRST populated kind on this tagged union in canonical ClosedSet::ALL order, or None when no slot is populated. Read more
Source§

fn first_missing_kind(&self) -> Option<Self::Kind>

Short-circuiting Option<Self::Kind> peer of Self::missing_kinds — the FIRST missing kind on this tagged union in canonical ClosedSet::ALL order, or None when EVERY slot is populated. Read more
Source§

impl VariantSelector<Intent> for IntentKind

Source§

type Variant<'a> = IntentVariant<'a>

The borrowed-view enum returned by the parent’s inherent .variant() method — one arm per closed-set variant, each arm carrying a &'a reference into the parent’s populated slot. Bound generically here so TaggedUnion::variant’s default body can name the return type without restating it per parent. Additionally bound to VariantKind<Self> so the reverse projection Variant<'a> → Self is closed at the trait boundary — every implementor’s borrowed view knows its addressing Kind through ONE typed contract, and the substrate testkit assert_variant_round_trip composes select (forward) with variant_kind (reverse) generically.
Source§

fn select<'a>(self, parent: &'a Intent) -> Option<IntentVariant<'a>>
where Self: 'a,

Project a &'a P borrow into the optional typed variant view for self (the addressed discriminator). Returns None iff the matching slot on P is None. Composes the closed-set sweep TaggedUnion::variant loops over.

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<T> AppData for T
where T: OptionalSend + OptionalSync + 'static + OptionalSerde,

Source§

impl<T> AppDataResponse for T
where T: OptionalSend + OptionalSync + 'static + OptionalSerde,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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

impl<T> OptionalSend for T
where T: Send + ?Sized,

Source§

impl<T> OptionalSync for T
where T: Sync + ?Sized,

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