Term

Struct Term 

Source
pub struct Term<PT: ProtocolTypes> {
    pub term: DYTerm<PT>,
    pub payloads: Option<Payloads>,
}
Expand description

Terms are Terms equipped with optional Payloads when they no longer are treated as symbolic terms.

Fields§

§term: DYTerm<PT>§payloads: Option<Payloads>

Implementations§

Source§

impl<PT: ProtocolTypes> Term<PT>

Source

pub(crate) fn eval_until_opaque<PB>( &self, eval_tree: &mut EvalTree, ctx: &TraceContext<PB>, with_payloads: bool, sibling_has_payloads: bool, type_term: &TypeShape<PT>, ) -> Result<(Box<dyn EvaluatedTerm<PT>>, Vec<PayloadContext<'_, PT>>), Error>
where PB: ProtocolBehavior<ProtocolTypes = PT>,

Evaluate a term without replacing the payloads (returning the payloads with the corresponding paths instead, i.e., a Vec<PayloadContext> accumulator), except when reaching an opaque term with payloads as strict sub-terms. In the latter case, fully evaluate each of the arguments (and performing the payload replacements) before evaluating the opaque function, which then needs to be read to convert it back to a Box<dyn EvaluatedTerm<PT>>. @path: current path of &self in the overall recipe (initially []). Invariant: Returns the payloads to replace in this order: deeper first, left-most arguments first. When with_payloads is false, then this should be equivalent to evaluate_lazy_test and it always return empty PayloadContext vectors.

Source§

impl<PT: ProtocolTypes> Term<PT>

Source

pub fn height(&self) -> usize

Height of term, considering non-symbolic terms as atoms

Source

pub fn is_list(&self) -> bool

When the term starts with a list function symbol

Source

pub fn is_opaque(&self) -> bool

When the term starts with an opaque function symbol (like encryption)

Source

pub fn is_get(&self) -> bool

When the term starts with an opaque function symbol (like encryption)

Source

pub fn is_no_bit(&self) -> bool

When the term starts with a no_bit function symbol. We will never MakeMessage on, thus disabling applying any of the bit-level mutations.

Source

pub fn is_no_det(&self) -> bool

When the term starts with a no_det function symbol.

Source

pub fn has_variable(&self) -> bool

When the term has a variable as sub-term (excluding strict-sub-terms of readable)

Source

pub fn has_no_det(&self) -> bool

When the term has a non-det sub-term (excluding strict-sub-terms of readable)

Source

pub fn is_readable(&self) -> bool

Whether the term is readable, i.e. whether it has a payload that will be read before evaluating

Source

pub fn erase_payloads_subterms(&mut self, is_subterm: bool)

Erase all payloads in a term, including those under opaque function symbol

Source

pub fn add_payload_with_new( &mut self, payload_0: Vec<u8>, payload_new: Vec<u8>, with_metadata: Option<PayloadMetadata>, )

Add a payload at the root position and start with a new payload.payload possibly different from payload.payload_0, erase payloads in strict sub-terms not under opaque

Source

pub fn add_payload(&mut self, payload_0: Vec<u8>)

Add a payload at the root position, erase payloads in strict sub-terms not under opaque

Source

pub fn make_payload<PB>(&mut self, ctx: &TraceContext<PB>) -> Result<(), Error>
where PB: ProtocolBehavior<ProtocolTypes = PT>,

Make and Add a payload at the root position, erase payloads in strict sub-terms

Source

pub fn add_payload_readable(&mut self, payload: ConcreteMessage)

Add a payload at the root position, erase payloads in strict sub-terms and make the payload readable.

Source

pub fn all_payloads(&self) -> Vec<&Payloads>

Return all payloads contains in a term, even under opaque terms. Note that we keep the invariant that a non-symbolic term cannot have payloads in strict-subterms, see add_payload/make_payload.

Source

pub fn count_payloads(&self) -> usize

Number of payloads in a term, without allocating (unlike all_payloads().len(), which materialises a Vec via the &Term iterator). Cheap enough for the hot mutation path.

Mirrors the iterator’s traversal exactly so the count equals all_payloads().len(): count this node’s own payload, and recurse into sub-terms only while the node is symbolic (a non-symbolic term keeps the invariant that it has no payloads in its strict sub-terms).

Source

pub fn all_payloads_mut(&mut self) -> Vec<&mut Payloads>

Return all payloads contains in a term (mutable references), even under opaque terms. Note that we keep the invariant that a non-symbolic term cannot have payloads in strict-subterms, see add_payload/make_payload.

Source

pub fn payloads_to_replace(&self) -> Vec<&Payloads>

Return all payloads contained in a term, except those under opaque or readable terms. The deeper the first in the returned vector.

Source

pub fn has_payload_to_replace(&self) -> bool

Return whether there is at least one payload, except those under opaque or readable terms.

Source

pub fn has_payload_to_replace_wo_root(&self) -> bool

Return whether there is at least one payload, except those under opaque terms or readable and at the root.

Source§

impl<PT: ProtocolTypes> Term<PT>

Source

fn unique_id(&self, tree_mode: bool, cluster_id: usize) -> String

Source

fn node_attributes( displayable: impl Display, color: &str, shape: &str, ) -> String

Source

fn collect_statements( term: &Self, tree_mode: bool, cluster_id: usize, statements: &mut Vec<String>, )

Source

pub fn dot_subgraph( &self, tree_mode: bool, cluster_id: usize, label: &str, ) -> String

If tree_mode is true then each subgraph is self-contained and does not reference other clusters or nodes outside of this subgraph. Therefore, only trees are generated. If it is false, then graphs are rendered.

Source§

impl<PT: ProtocolTypes> Term<PT>

Source

pub fn count_functions_by_name(&self, find_name: &'static str) -> usize

Trait Implementations§

Source§

impl<PT: Clone + ProtocolTypes> Clone for Term<PT>

Source§

fn clone(&self) -> Term<PT>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<PT: Debug + ProtocolTypes> Debug for Term<PT>

Source§

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

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

impl<'de, PT> Deserialize<'de> for Term<PT>
where PT: ProtocolTypes,

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<PT: ProtocolTypes> Display for Term<PT>

Source§

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

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

impl<PT: ProtocolTypes> From<DYTerm<PT>> for Term<PT>

Source§

fn from(term: DYTerm<PT>) -> Self

Converts to this type from the input type.
Source§

impl<PT: ProtocolTypes> From<Term<PT>> for DYTerm<PT>

Source§

fn from(term: Term<PT>) -> Self

Converts to this type from the input type.
Source§

impl<PT: Hash + ProtocolTypes> Hash for Term<PT>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a, PT: ProtocolTypes> IntoIterator for &'a Term<PT>

Having the same mutator for &’a mut DYTerm is not possible in Rust:

Source§

type IntoIter = IntoIter<&'a Term<PT>>

Which kind of iterator are we turning this into?
Source§

type Item = &'a Term<PT>

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<PT: PartialEq + ProtocolTypes> PartialEq for Term<PT>

Source§

fn eq(&self, other: &Term<PT>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<PT> Serialize for Term<PT>
where PT: ProtocolTypes,

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<PT: ProtocolTypes> Subterms<PT, Term<PT>> for Vec<Term<PT>>

Source§

fn find_subterm_same_shape(&self, term: &Term<PT>) -> Option<&Term<PT>>

Finds a subterm with the same type as term

Source§

fn find_subterm<P: Fn(&&Term<PT>) -> bool + Copy>( &self, predicate: P, ) -> Option<&Term<PT>>

Finds a subterm in this vector

Source§

fn filter_grand_subterms<P: Fn(&Term<PT>, &Term<PT>) -> bool + Copy>( &self, predicate: P, ) -> Vec<((usize, &Term<PT>), &Term<PT>)>

Finds all grand children/subterms which match the predicate.

A grand subterm is defined as a subterm of a term in self.

Each grand subterm is returned together with its parent and the index of the parent in self.

Source§

impl<PT: ProtocolTypes> TermType<PT> for Term<PT>

Source§

fn evaluate_config<PB: ProtocolBehavior<ProtocolTypes = PT>>( &self, context: &TraceContext<PB>, with_payloads: bool, ) -> Result<(ConcreteMessage, Box<dyn EvaluatedTerm<PT>>), Error>

Evaluate terms into bitstrings and EvaluatedTerm (considering Payloads)

Source§

fn size(&self) -> usize

size of a term, considering non-symbolic terms as atoms

Source§

fn resistant_id(&self) -> u32

Source§

fn is_leaf(&self) -> bool

Source§

fn get_type_shape(&self) -> &TypeShape<PT>

Source§

fn name(&self) -> &str

Source§

fn mutate(&mut self, other: Self)

Source§

fn display_at_depth(&self, depth: usize) -> String

Source§

fn is_symbolic(&self) -> bool

Source§

fn make_symbolic(&mut self)

Source§

fn get(&self, path: &[usize]) -> Result<&Self, Error>

Source§

fn evaluate_config_wrap<PB: ProtocolBehavior<ProtocolTypes = PT>>( &self, context: &TraceContext<PB>, with_payloads: bool, ) -> Result<(ConcreteMessage, Box<dyn EvaluatedTerm<PT>>), Error>

Wrap evaluate_config with error stats and logging handling
Source§

fn evaluate<PB: ProtocolBehavior<ProtocolTypes = PT>>( &self, ctx: &TraceContext<PB>, ) -> Result<ConcreteMessage, Error>

Evaluate terms into ConcreteMessage (considering Payloads)
Source§

fn evaluate_symbolic<PB: ProtocolBehavior<ProtocolTypes = PT>>( &self, ctx: &TraceContext<PB>, ) -> Result<ConcreteMessage, Error>

Evaluate terms into ConcreteMessage considering all sub-terms as symbolic (even those with Payloads)
Source§

fn evaluate_dy<PB: ProtocolBehavior<ProtocolTypes = PT>>( &self, ctx: &TraceContext<PB>, ) -> Result<Box<dyn EvaluatedTerm<PT>>, Error>

Evaluate terms into EvaluatedTerm considering all sub-terms as symbolic (even those with Payloads)
Source§

impl<PT: Eq + ProtocolTypes> Eq for Term<PT>

Source§

impl<PT: ProtocolTypes> StructuralPartialEq for Term<PT>

Auto Trait Implementations§

§

impl<PT> Freeze for Term<PT>
where <PT as ProtocolTypes>::Matcher: Freeze,

§

impl<PT> !RefUnwindSafe for Term<PT>

§

impl<PT> Send for Term<PT>
where PT: Send, <PT as ProtocolTypes>::Matcher: Send,

§

impl<PT> Sync for Term<PT>
where PT: Sync, <PT as ProtocolTypes>::Matcher: Sync,

§

impl<PT> Unpin for Term<PT>
where PT: Unpin, <PT as ProtocolTypes>::Matcher: Unpin,

§

impl<PT> !UnwindSafe for Term<PT>

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<Head, T> Append<T> for Head

§

fn append(self, value: T) -> (Head, T)

Append Value and return the tuple
Source§

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

Source§

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

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<T> CloneAny for T
where T: Any + Clone + Send + Sync,

§

fn clone_any(&self) -> Box<dyn CloneAny>

§

fn clone_any_send(&self) -> Box<dyn CloneAny + Send>

§

fn clone_any_sync(&self) -> Box<dyn CloneAny + Sync>

§

fn clone_any_send_sync(&self) -> Box<dyn CloneAny + Send + Sync>

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

§

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

§

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
§

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

§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
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<I, S> MutatedTransform<I, S> for I
where I: Clone, S: HasCorpus<I>,

§

type Post = ()

Type indicating actions to be taken after the post-transformation input is executed
§

fn try_transform_from(base: &mut Testcase<I>, state: &S) -> Result<I, Error>

Transform the provided testcase into this type
§

fn try_transform_into( self, _state: &S, ) -> Result<(I, <I as MutatedTransform<I, S>>::Post), Error>

Transform this instance back into the original input type
§

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<Tail, T> Prepend<T> for Tail

§

fn prepend(self, value: T) -> (T, Tail)

Prepend a value to this tuple, returning a new tuple with prepended value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

§

impl<T> ToCompactString for T
where T: Display,

§

fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>

Fallible version of [ToCompactString::to_compact_string()] Read more
§

fn to_compact_string(&self) -> CompactString

Converts the given value to a [CompactString]. Read more
§

impl<T> ToLine for T
where T: Display,

§

fn to_line(&self) -> Line<'_>

Converts the value to a [Line].
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
§

impl<T> ToSpan for T
where T: Display,

§

fn to_span(&self) -> Span<'_>

Converts the value to a [Span].
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T> ToText for T
where T: Display,

§

fn to_text(&self) -> Text<'_>

Converts the value to a [Text].
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> DebugAny for T
where T: Any + Debug,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

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