pub struct FormatSettings {Show 72 fields
pub print_width: usize,
pub tab_width: usize,
pub use_tabs: bool,
pub end_of_line: EndOfLine,
pub single_quote: bool,
pub trailing_comma: bool,
pub remove_trailing_close_tag: bool,
pub control_brace_style: BraceStyle,
pub closure_brace_style: BraceStyle,
pub function_brace_style: BraceStyle,
pub method_brace_style: BraceStyle,
pub classlike_brace_style: BraceStyle,
pub inline_empty_control_braces: bool,
pub inline_empty_closure_braces: bool,
pub inline_empty_function_braces: bool,
pub inline_empty_method_braces: bool,
pub inline_empty_constructor_braces: bool,
pub inline_empty_classlike_braces: bool,
pub inline_empty_anonymous_class_braces: bool,
pub method_chain_breaking_style: MethodChainBreakingStyle,
pub first_method_chain_on_new_line: bool,
pub preserve_breaking_member_access_chain: bool,
pub preserve_breaking_argument_list: bool,
pub preserve_breaking_array_like: bool,
pub preserve_breaking_parameter_list: bool,
pub preserve_breaking_attribute_list: bool,
pub preserve_breaking_conditional_expression: bool,
pub break_promoted_properties_list: bool,
pub line_before_binary_operator: bool,
pub always_break_named_arguments_list: bool,
pub always_break_attribute_named_argument_lists: bool,
pub array_table_style_alignment: bool,
pub align_assignment_like: bool,
pub sort_uses: bool,
pub sort_class_methods: bool,
pub separate_use_types: bool,
pub expand_use_groups: bool,
pub null_type_hint: NullTypeHint,
pub parentheses_around_new_in_member_access: bool,
pub parentheses_in_new_expression: bool,
pub parentheses_in_exit_and_die: bool,
pub parentheses_in_attribute: bool,
pub space_before_arrow_function_parameter_list_parenthesis: bool,
pub space_before_closure_parameter_list_parenthesis: bool,
pub space_before_hook_parameter_list_parenthesis: bool,
pub space_before_closure_use_clause_parenthesis: bool,
pub space_after_cast_unary_prefix_operators: bool,
pub space_after_reference_unary_prefix_operator: bool,
pub space_after_error_control_unary_prefix_operator: bool,
pub space_after_logical_not_unary_prefix_operator: bool,
pub space_after_bitwise_not_unary_prefix_operator: bool,
pub space_after_increment_unary_prefix_operator: bool,
pub space_after_decrement_unary_prefix_operator: bool,
pub space_after_additive_unary_prefix_operator: bool,
pub space_around_concatenation_binary_operator: bool,
pub space_around_assignment_in_declare: bool,
pub space_within_grouping_parenthesis: bool,
pub empty_line_after_control_structure: bool,
pub empty_line_after_opening_tag: bool,
pub empty_line_after_declare: bool,
pub empty_line_after_namespace: bool,
pub empty_line_after_use: bool,
pub empty_line_after_symbols: bool,
pub empty_line_between_same_symbols: bool,
pub empty_line_after_class_like_constant: bool,
pub empty_line_after_enum_case: bool,
pub empty_line_after_trait_use: bool,
pub empty_line_after_property: bool,
pub empty_line_after_method: bool,
pub empty_line_before_return: bool,
pub empty_line_before_dangling_comments: bool,
pub separate_class_like_members: bool,
}Expand description
Format settings for the PHP printer.
Fields§
§print_width: usizeMaximum line length that the printer will wrap on.
Default: 120
tab_width: usizeNumber of spaces per indentation level.
Default: 4
use_tabs: boolWhether to use tabs instead of spaces for indentation.
Default: false
end_of_line: EndOfLineEnd-of-line characters to use.
Default: “lf”
single_quote: boolWhether to use single quotes instead of double quotes for strings.
The formatter automatically determines which quotes to use based on the string content, with a preference for single quotes if this option is enabled.
Decision logic:
- If the string contains more single quotes than double quotes, double quotes are used
- If the string contains more double quotes than single quotes, single quotes are used
- If equal number of both, single quotes are used if this option is true
Default: true
trailing_comma: boolWhether to add a trailing comma to the last element in multi-line syntactic structures.
When enabled, trailing commas are added to lists, arrays, parameter lists, argument lists, and other similar structures when they span multiple lines.
Default: true
remove_trailing_close_tag: boolWhether to remove the trailing PHP close tag (?>) from files.
Default: true
control_brace_style: BraceStyleBrace placement for control structures (if, for, while, etc.).
Example with same_line:
if ($expr) {
return 'Hello, world!';
}Example with next_line:
if ($expr)
{
return 'Hello, world!';
}Default: same_line
closure_brace_style: BraceStyleBrace placement for closures.
Example with same_line:
$closure = function() {
return 'Hello, world!';
};Example with next_line:
$closure = function()
{
return 'Hello, world!';
};Default: same_line
function_brace_style: BraceStyleBrace placement for function declarations.
Example with same_line:
function foo() {
return 'Hello, world!';
}Example with next_line:
function foo()
{
return 'Hello, world!';
}Default: next_line
method_brace_style: BraceStyleBrace placement for method declarations.
Example with same_line:
class Foo
{
public function bar() {
return 'Hello, world!';
}
}Example with next_line:
class Foo
{
public function bar()
{
return 'Hello, world!';
}
}Default: next_line
classlike_brace_style: BraceStyleBrace placement for class-like structures (classes, interfaces, traits, enums).
Example with same_line:
class Foo {
}Example with next_line:
class Foo
{
}Default: next_line
inline_empty_control_braces: boolPlace empty control structure bodies on the same line.
Example with false:
if ($expr)
{
}Example with true:
if ($expr) {}Default: false
inline_empty_closure_braces: boolPlace empty closure bodies on the same line.
Example with false:
$closure = function()
{
};Example with true:
$closure = function() {};Default: true
inline_empty_function_braces: boolPlace empty function bodies on the same line.
Example with false:
function foo()
{
}Example with true:
function foo() {}Default: false
inline_empty_method_braces: boolPlace empty method bodies on the same line.
Example with false:
class Foo
{
public function bar()
{
}
}Example with true:
class Foo
{
public function bar() {}
}Default: false
inline_empty_constructor_braces: boolPlace empty constructor bodies on the same line.
Example with false:
class Foo {
public function __construct()
{
}
}Example with true:
class Foo {
public function __construct() {}
}Default: true
inline_empty_classlike_braces: boolPlace empty class-like bodies on the same line.
Example with false:
class Foo
{
}Example with true:
class Foo {}Default: true
inline_empty_anonymous_class_braces: boolPlace empty anonymous class bodies on the same line.
Example with false:
$anon = new class
{
};Example with true:
$anon = new class {};Default: true
method_chain_breaking_style: MethodChainBreakingStyleHow to format broken method/property chains.
When next_line, the first method/property starts on a new line:
$foo
->bar()
->baz();When same_line, the first method/property stays on the same line:
$foo->bar()
->baz();Default: next_line
first_method_chain_on_new_line: boolWhen method chaining breaks across lines, place the first method on a new line.
This follows PER-CS 4.7: “When [method chaining is] put on separate lines, […] the first method MUST be on the next line.”
When enabled:
$this
->getCache()
->forget();When disabled:
$this->getCache()
->forget();Default: true
preserve_breaking_member_access_chain: boolWhether to preserve line breaks in method chains, even if they could fit on a single line.
Default: false
preserve_breaking_argument_list: boolWhether to preserve line breaks in argument lists, even if they could fit on a single line.
Default: false
preserve_breaking_array_like: boolWhether to preserve line breaks in array-like structures, even if they could fit on a single line.
Default: true
preserve_breaking_parameter_list: boolWhether to preserve line breaks in parameter lists, even if they could fit on a single line.
Default: false
preserve_breaking_attribute_list: boolWhether to preserve line breaks in attribute lists, even if they could fit on a single line.
Default: false
preserve_breaking_conditional_expression: boolWhether to preserve line breaks in conditional (ternary) expressions.
Default: false
break_promoted_properties_list: boolWhether to break a parameter list with one or more promoted properties into multiple lines.
When enabled, parameter lists with promoted properties are always multi-line:
class User {
public function __construct(
public string $name,
public string $email,
) {}
}When disabled, they may be kept on a single line if space allows:
class User {
public function __construct(public string $name, public string $email) {}
}Default: true
line_before_binary_operator: boolWhether to add a line before binary operators or after when breaking.
When true:
$foo = 'Hello, '
. 'world!';When false:
$foo = 'Hello, ' .
'world!';Note: If the right side has a leading comment, this setting is always false.
Default: true
always_break_named_arguments_list: boolWhether to always break named argument lists into multiple lines.
When enabled:
$foo = some_function(
argument1: 'value1',
argument2: 'value2',
);Default: false
always_break_attribute_named_argument_lists: boolWhether to always break named argument lists in attributes into multiple lines.
When enabled:
#[SomeAttribute(
argument1: 'value1',
argument2: 'value2',
)]
class Foo {}Default: false
array_table_style_alignment: boolWhether to use table-style alignment for arrays.
When enabled, array elements are aligned in a table-like format:
$array = [
['foo', 1.2, 123, false],
['bar', 52.4, 456, true],
['baz', 3.6, 789, false],
['qux', 4.8, 1, true],
['quux', 5.0, 12, false],
];Default: true
align_assignment_like: boolWhether to align consecutive assignment-like constructs in columns.
When enabled, consecutive variable assignments, class properties, class constants, global constants, array key-value pairs, and backed enum cases are column-aligned.
Example with true:
$foo = 1;
$b = 2;
$ccccccc = 3;
class X {
public string $foo = 1;
public readonly int $barrrr = 2;
}Example with false:
$foo = 1;
$b = 2;
$ccccccc = 3;Note: Blank lines and comments break alignment runs. In class bodies, different member types (properties vs constants) are aligned separately.
Default: false
sort_uses: boolWhether to sort use statements alphabetically.
Default: true
sort_class_methods: boolWhether to sort class methods by visibility and name.
When enabled, methods in class-like structures are automatically reordered:
- Constructor (
__construct) - always first - Static methods (by visibility: public, protected, private)
- Abstract methods before concrete methods
- Alphabetically by name within each group
- Instance methods (by visibility: public, protected, private)
- Abstract methods before concrete methods
- Alphabetically by name within each group
- Other magic methods (e.g.,
__toString,__get,__set)- Sorted alphabetically by name
- Destructor (
__destruct) - always last
This applies to all class-like structures: classes, traits, interfaces, and enums. Other members (constants, properties, trait uses, enum cases) remain in their original positions.
Default: false
separate_use_types: boolWhether to insert a blank line between different types of use statements.
When enabled:
use Foo\Bar;
use Foo\Baz;
use function Foo\bar;
use function Foo\baz;
use const Foo\A;
use const Foo\B;When disabled:
use Foo\Bar;
use Foo\Baz;
use function Foo\bar;
use function Foo\baz;
use const Foo\A;
use const Foo\B;Default: true
expand_use_groups: boolWhether to expand grouped use statements into individual statements.
When enabled:
use Foo\Bar;
use Foo\Baz;When disabled:
use Foo\{Bar, Baz};Default: true
null_type_hint: NullTypeHintHow to format null type hints.
With Question:
function foo(?string $bar) {
return $bar;
}With NullPipe:
function foo(null|string $bar) {
return $bar;
}Default: Question
parentheses_around_new_in_member_access: boolWhether to include parentheses around new when followed by a member access.
Controls whether to use PHP 8.4’s shorthand syntax for new expressions followed by member access. If PHP version is earlier than 8.4, this is always true.
When enabled:
$foo = (new Foo)->bar();When disabled (PHP 8.4+ only):
$foo = new Foo->bar();Default: false
parentheses_in_new_expression: boolWhether to include parentheses in new expressions when no arguments are provided.
When enabled:
$foo = new Foo();When disabled:
$foo = new Foo;Default: true
parentheses_in_exit_and_die: boolWhether to include parentheses in exit and die constructs.
When enabled:
exit();
die();When disabled:
exit;
die;Default: true
parentheses_in_attribute: boolWhether to include parentheses in attributes with no arguments.
When enabled:
#[SomeAttribute()]
class Foo {}When disabled:
#[SomeAttribute]
class Foo {}Default: false
space_before_arrow_function_parameter_list_parenthesis: boolWhether to add a space before the opening parameters in arrow functions.
When enabled: fn ($x) => $x * 2
When disabled: fn($x) => $x * 2
Default: false
space_before_closure_parameter_list_parenthesis: boolWhether to add a space before the opening parameters in closures.
When enabled: function ($x) use ($y)
When disabled: function($x) use ($y)
Default: true
space_before_hook_parameter_list_parenthesis: boolWhether to add a space before the opening parameters in hooks.
When enabled: $hook ($param)
When disabled: $hook($param)
Default: false
space_before_closure_use_clause_parenthesis: boolWhether to add a space before the opening parenthesis in closure use clause.
When enabled: function() use ($var)
When disabled: function() use($var)
Default: true
space_after_cast_unary_prefix_operators: boolWhether to add a space after cast operators (int, float, string, etc.).
When enabled: (int) $foo
When disabled: (int)$foo
Default: true
space_after_reference_unary_prefix_operator: boolWhether to add a space after the reference operator (&).
When enabled: & $foo
When disabled: &$foo
Default: false
space_after_error_control_unary_prefix_operator: boolWhether to add a space after the error control operator (@).
When enabled: @ $foo
When disabled: @$foo
Default: false
space_after_logical_not_unary_prefix_operator: boolWhether to add a space after the logical not operator (!).
When enabled: ! $foo
When disabled: !$foo
Default: false
space_after_bitwise_not_unary_prefix_operator: boolWhether to add a space after the bitwise not operator (~).
When enabled: ~ $foo
When disabled: ~$foo
Default: false
space_after_increment_unary_prefix_operator: boolWhether to add a space after the increment prefix operator (++).
When enabled: ++ $i
When disabled: ++$i
Default: false
space_after_decrement_unary_prefix_operator: boolWhether to add a space after the decrement prefix operator (–).
When enabled: -- $i
When disabled: --$i
Default: false
space_after_additive_unary_prefix_operator: boolWhether to add a space after the additive unary operators (+ and -).
When enabled: + $i
When disabled: +$i
Default: false
space_around_concatenation_binary_operator: boolWhether to add spaces around the concatenation operator (.)
When enabled: $a . $b
When disabled: $a.$b
Default: true
space_around_assignment_in_declare: boolWhether to add spaces around the assignment in declare statements.
When enabled: declare(strict_types = 1)
When disabled: declare(strict_types=1)
Default: false
space_within_grouping_parenthesis: boolWhether to add spaces within grouping parentheses.
When enabled: ( $expr ) - $expr
When disabled: ($expr) - $expr
Default: false
empty_line_after_control_structure: boolWhether to add an empty line after control structures (if, for, foreach, while, do, switch).
Note: if an empty line already exists, it will be preserved regardless of this settings value.
Default: false
empty_line_after_opening_tag: boolWhether to add an empty line after opening tag.
Note: if an empty line already exists, it will be preserved regardless of this settings value.
Default: true
empty_line_after_declare: boolWhether to add an empty line after declare statement.
Note: if an empty line already exists, it will be preserved regardless of this settings value.
Default: true
empty_line_after_namespace: boolWhether to add an empty line after namespace.
Note: if an empty line already exists, it will be preserved regardless of this settings value.
Default: true
empty_line_after_use: boolWhether to add an empty line after use statements.
Note: if an empty line already exists, it will be preserved regardless of this settings value.
Default: true
empty_line_after_symbols: boolWhether to add an empty line after symbols (class, enum, interface, trait, function, const).
Note: if an empty line already exists, it will be preserved regardless of this settings value.
Default: true
empty_line_between_same_symbols: boolWhether to add an empty line between consecutive symbols of the same type.
Only applies when empty_line_after_symbols is true.
Default: true
empty_line_after_class_like_constant: boolWhether to add an empty line after class-like constant.
Note: if an empty line already exists, it will be preserved regardless of this settings value.
Default: false
empty_line_after_enum_case: boolWhether to add an empty line after enum case.
Note: if an empty line already exists, it will be preserved regardless of this settings value.
Default: false
empty_line_after_trait_use: boolWhether to add an empty line after trait use.
Note: if an empty line already exists, it will be preserved regardless of this settings value.
Default: false
empty_line_after_property: boolWhether to add an empty line after property.
Note: if an empty line already exists, it will be preserved regardless of this settings value.
Default: false
empty_line_after_method: boolWhether to add an empty line after method.
Note: if an empty line already exists, it will be preserved regardless of this settings value.
Default: true
empty_line_before_return: boolWhether to add an empty line before return statements.
Default: false
empty_line_before_dangling_comments: boolWhether to add an empty line before dangling comments.
Default: true
separate_class_like_members: boolWhether to separate class-like members of different kinds with a blank line.
Default: true
Trait Implementations§
Source§impl Clone for FormatSettings
impl Clone for FormatSettings
Source§fn clone(&self) -> FormatSettings
fn clone(&self) -> FormatSettings
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FormatSettings
impl Debug for FormatSettings
Source§impl Default for FormatSettings
impl Default for FormatSettings
Source§impl<'de> Deserialize<'de> for FormatSettings
impl<'de> Deserialize<'de> for FormatSettings
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for FormatSettings
impl Hash for FormatSettings
Source§impl JsonSchema for FormatSettings
impl JsonSchema for FormatSettings
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for FormatSettings
impl Ord for FormatSettings
Source§fn cmp(&self, other: &FormatSettings) -> Ordering
fn cmp(&self, other: &FormatSettings) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for FormatSettings
impl PartialEq for FormatSettings
Source§impl PartialOrd for FormatSettings
impl PartialOrd for FormatSettings
Source§impl Serialize for FormatSettings
impl Serialize for FormatSettings
impl Copy for FormatSettings
impl Eq for FormatSettings
impl StructuralPartialEq for FormatSettings
Auto Trait Implementations§
impl Freeze for FormatSettings
impl RefUnwindSafe for FormatSettings
impl Send for FormatSettings
impl Sync for FormatSettings
impl Unpin for FormatSettings
impl UnwindSafe for FormatSettings
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§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();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§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();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§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();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§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();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.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§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);