Skip to main content

Rocksdb

Struct Rocksdb 

Source
pub struct Rocksdb {
Show 27 fields pub cache_capacity_mb: f64, pub write_buffer_capacity_mb: f64, pub log_level: String, pub log_stderr: bool, pub max_log_file_size: usize, pub log_time_to_roll: usize, pub optimize_for_spinning_disks: bool, pub direct_io: bool, pub parallelism_threads: usize, pub max_log_files: usize, pub compression_algo: String, pub compression_level: i32, pub bottommost_compression_level: i32, pub bottommost_compression: bool, pub recovery_mode: u8, pub paranoid_file_checks: bool, pub checksums: bool, pub atomic_flush: bool, pub repair: bool, pub read_only: bool, pub secondary: bool, pub compaction_prio_idle: bool, pub compaction_ioprio_idle: bool, pub compaction: bool, pub stats_level: u8, pub never_drop_columns: bool, pub allow_fallocate: bool,
}
Expand description

RocksDB storage engine

Tunes the RocksDB engine behind the database at database_path. Every key is read when the database opens, so changes need a restart. The defaults assume SSD or NVMe storage, and most keys only trade memory, threads or log volume for speed or diagnostics.

The recovery keys are different: recovery_mode 2 or 3 and repair can discard data, so back up database_path first and revert them once the server starts cleanly.

Tips:

  • On btrfs or ZFS set allow_fallocate = false; startup warns while it is left on there. On ZFS also set direct_io = false.
  • recovery_mode accepts 0 to 3; a larger value panics at startup.
  • cache.capacity_modifier also scales write_buffer_capacity_mb.

Fields§

§cache_capacity_mb: f64

Sets the memory available to database read caches as a float in megabytes.

Increasing this may improve performance when memory is available; like individual LRU caches, the default scales with CPU core count to 128.0 + (64.0

  • CPU core count).

default: varies by system legacy: db_cache_capacity_mb

§write_buffer_capacity_mb: f64

Sets the memory available to database write caches as a float in megabytes.

Increasing this may improve performance when memory is available; like individual LRU caches, the default scales with CPU core count to 48.0 + (4.0 * CPU core count).

default: varies by system legacy: db_write_buffer_capacity_mb

§log_level: String

Sets the log level for RocksDB LOG files in the database directory.

This differs from the application log level; tuwunel still reports RocksDB errors through tracing or panics on severe errors for safety.

default: “error” legacy: rocksdb_log_level

§log_stderr: bool

Routes RocksDB log messages to standard error.

rocksdb.log_level still filters the emitted records. When disabled, RocksDB uses the application’s callback logger instead. legacy: rocksdb_log_stderr

§max_log_file_size: usize

Sets the maximum RocksDB LOG file size before rotation.

Accepts an integer byte count or a string with SI/IEC suffix such as “4 MiB”.

default: 4194304 legacy: rocksdb_max_log_file_size

§log_time_to_roll: usize

Time in seconds before RocksDB will forcibly rotate logs.

default: 0 legacy: rocksdb_log_time_to_roll

§optimize_for_spinning_disks: bool

Uses RocksDB tunings tailored to spinning disks (HDDs).

Leave this disabled on NVMe or SSD storage. When enabled, RocksDB skips compaction readahead and parallel file-open threads at startup. This does not affect Direct IO; see rocksdb.direct_io.

legacy: rocksdb_optimize_for_spinning_disks

§direct_io: bool

Enables direct-io to increase database performance via unbuffered I/O.

For more details about direct I/O and RockDB, see: https://github.com/facebook/rocksdb/wiki/Direct-IO

Set this option to false if the database resides on a filesystem which does not support direct-io like FUSE, or any form of complex filesystem setup such as possibly ZFS. legacy: rocksdb_direct_io

§parallelism_threads: usize

Sets the number of RocksDB threads for cleanup, sync, flush, and compaction.

The stored value 0 selects the available logical thread count, with a minimum of two.

default: 0 legacy: rocksdb_parallelism_threads

§max_log_files: usize

Sets the maximum number of RocksDB LOG files retained.

This must be at least 1, never 0. The default is 3 because these logs are mainly useful for troubleshooting or debugging RocksDB bugs.

default: 3 legacy: rocksdb_max_log_files

§compression_algo: String

Sets the RocksDB database compression algorithm.

Available options are “zstd”, “bz2”, “lz4”, or “none”, which disables compression. ZSTD balances speed, storage, IO amplification, and CPU usage; LZ4 offers more performance and lower CPU usage with less compression and more storage use. See https://github.com/facebook/rocksdb/wiki/Compression for details.

default: “zstd” legacy: rocksdb_compression_algo

§compression_level: i32

Level of compression the specified compression algorithm for RocksDB to use.

Default is 32767, which is internally read by RocksDB as the default magic number and translated to the library’s default compression level as they all differ. See their kDefaultCompressionLevel.

Note when using the default value we may override it with a setting tailored specifically tuwunel.

default: 32767 legacy: rocksdb_compression_level

§bottommost_compression_level: i32

Sets the compression level for the bottommost RocksDB data.

The default 32767 is RocksDB’s kDefaultCompressionLevel, translated to the selected library’s default level; tuwunel may override it with a tailored setting. Bottommost data is generally old and less frequently accessed, so higher compression may be useful; research the chosen algorithm.

default: 32767 legacy: rocksdb_bottommost_compression_level

§bottommost_compression: bool

Whether to enable RocksDB’s “bottommost_compression”.

At the expense of more CPU usage, this will further compress the database to reduce more storage. It is recommended to use ZSTD compression with this for best compression results. This may be useful if you’re trying to reduce storage usage from the database.

See https://github.com/facebook/rocksdb/wiki/Compression for more details. legacy: rocksdb_bottommost_compression

§recovery_mode: u8

Sets the database recovery mode for RocksDB WAL corruption.

When corruption prevents startup, use mode 2 (PointInTime) to recover to the last good state, seconds or minutes before the crash. Clients may need “clear-cache & reload” after this rollback. After recovery succeeds, reset the mode to its default and restart. In some cases the corruption error persists for at least 30 minutes of operation in PointInTime mode.

Only as a last resort if PointInTime fails, try mode 3 (SkipAnyCorruptedRecord), which may leave the server inconsistent. Default mode 1 (TolerateCorruptedTailRecords) drops only the last entry if corrupted during shutdown, with an extraordinarily low risk of desynchronizing clients. Mode 0 (AbsoluteConsistency) disables all silent rollback. See https://github.com/facebook/rocksdb/wiki/WAL-Recovery-Modes for mode details and https://tuwunel.chat/troubleshooting.html#database-corruption for recovery guidance.

default: 1 legacy: rocksdb_recovery_mode

§paranoid_file_checks: bool

Enables paranoid SST file checks.

Additional safety checks may improve database consistency at a performance cost; see the RocksDB documentation for details: https://github.com/facebook/rocksdb/wiki/Online-Verification#columnfamilyoptionsparanoid_file_checks

legacy: rocksdb_paranoid_file_checks

§checksums: bool

Enables runtime checksum verification in RocksDB.

Checksums are enabled by default and usually hardware accelerated with low overhead. Older or slower platforms may gain performance by disabling them.

default: true legacy: rocksdb_checksums

§atomic_flush: bool

Enables RocksDB atomic flush mode.

This option is not intended for users and may be removed or ignored in future versions. It may improve database integrity at the cost of performance.

legacy: rocksdb_atomic_flush

§repair: bool

Enables database repair for RocksDB SST corruption.

Use this when the server reports corruption while running or panics, especially for errors containing SST after startup; if startup fails, try recovery mode first. Back up the database directory before running repair. Disable repair mode and restart the server after repair finishes. See https://tuwunel.chat/troubleshooting.html#database-corruption for recovery details.

legacy: rocksdb_repair

§read_only: bool

Opens RocksDB in read-only mode.

Writes are rejected and missing column families cannot be created. This mode is disabled by default. legacy: rocksdb_read_only

§secondary: bool

Opens RocksDB as a secondary follower of a primary instance.

Writes are rejected while the primary’s latest WAL can be replayed into this instance’s view. Missing column families cannot be created. legacy: rocksdb_secondary

§compaction_prio_idle: bool

Enables idle CPU priority for the compaction thread.

This is disabled by default to prevent compaction from falling too far behind on busy systems.

legacy: rocksdb_compaction_prio_idle

§compaction_ioprio_idle: bool

Enables idle IO priority for the compaction thread.

This is enabled by default and usually advisable to prevent unexpected server lag.

legacy: rocksdb_compaction_ioprio_idle

§compaction: bool

Enables RocksDB compaction.

You should never need to disable this; if troubleshooting or a bug appears to require it, contact the tuwunel Matrix room with details. Disabling compaction causes explosive database growth, gradually poor performance, excessive disk reads and writes, and slower shutdowns and startups.

legacy: rocksdb_compaction

§stats_level: u8

Sets the level of database statistics collection from 0 to 6.

Some admin commands that display database statistics require this setting; higher levels may affect performance. Level 0 disables statistics, level 1 disables them in release mode and is the default, levels 2 to 3 have no performance impact, levels 3 to 5 may affect performance, and level 6 collects all statistics.

default: 1 legacy: rocksdb_stats_level

§never_drop_columns: bool

Ignores the list of dropped columns set by developers.

This should be set to true when knowingly moving between versions in ways which are not recommended or otherwise forbidden, or for diagnostic and development purposes; requiring preservation across such movements.

The developer’s list of dropped columns is meant to safely reduce space by erasing data no longer in use. If this is set to true that storage will not be reclaimed as intended.

default: false legacy: rocksdb_never_drop_columns

§allow_fallocate: bool

Allows RocksDB to preallocate WAL logs.

Normally, RocksDB allocates certain types of files by calling fallocate, writing the file contents, then truncating the logs to the proper size. This causes pathological disk space usage on btrfs due to how it interacts with its Copy-on-Write implementation. On ZFS, fallocate(2) for preallocation is unsupported and returns EOPNOTSUPP; only FALLOC_FL_PUNCH_HOLE and FALLOC_FL_ZERO_RANGE are implemented.

Set this to false if you run the server on btrfs or ZFS, and do not touch it otherwise.

default: true legacy: rocksdb_allow_fallocate

Implementations§

Source§

impl Rocksdb

Source

pub(super) fn fmt_config(&self, out: &mut Formatter<'_>) -> Result

Trait Implementations§

Source§

impl Clone for Rocksdb

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 Rocksdb

Source§

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

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

impl Default for Rocksdb

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Rocksdb

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 Display for Rocksdb

Source§

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

Formats the value using the given formatter. Read more

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

§

impl<T> DropFlavorWrapper<T> for T

§

type Flavor = MayDrop

The DropFlavor that [wrap]s T into Self
Source§

impl<T> ExpectInto for T

Source§

fn expect_into<Dst: TryFrom<Self>>(self) -> Dst
where Self: Sized,

Converts the value into Dst and returns the successful result. Read more
Source§

impl<T> Expected for T

Source§

fn expected_add(self, rhs: Self) -> Self
where Self: CheckedAdd + Sized,

Adds rhs with an expectation that the operation is valid. Read more
Source§

fn expected_sub(self, rhs: Self) -> Self
where Self: CheckedSub + Sized,

Subtracts rhs with an expectation that the operation is valid. Read more
Source§

fn expected_mul(self, rhs: Self) -> Self
where Self: CheckedMul + Sized,

Multiplies by rhs with an expectation that the operation is valid. Read more
Source§

fn expected_div(self, rhs: Self) -> Self
where Self: CheckedDiv + Sized,

Divides by rhs with an expectation that the operation is valid. Read more
Source§

fn expected_rem(self, rhs: Self) -> Self
where Self: CheckedRem + Sized,

Computes the remainder with an expectation that the operation is valid. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

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

impl<T> Instrument for T

§

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

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

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
§

impl<T> JsonCastable<CanonicalJsonValue> for T

§

impl<T> JsonCastable<Value> for T

§

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

§

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
§

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> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ServiceExt for T

§

fn add_extension<T>(self, value: T) -> AddExtension<Self, T>
where Self: Sized,

Add some shareable value to request extensions. Read more
§

fn compression(self) -> Compression<Self>
where Self: Sized,

Compresses response bodies. Read more
§

fn decompression(self) -> Decompression<Self>
where Self: Sized,

Decompress response bodies. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. Read more
§

fn sensitive_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>
where Self: Sized,

Mark headers as sensitive on both requests and responses. Read more
§

fn sensitive_request_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveRequestHeaders<Self>
where Self: Sized,

Mark headers as sensitive on requests. Read more
§

fn sensitive_response_headers( self, headers: impl IntoIterator<Item = HeaderName>, ) -> SetSensitiveResponseHeaders<Self>
where Self: Sized,

Mark headers as sensitive on responses. Read more
§

fn override_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Insert a header into the request. Read more
§

fn append_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Append a header into the request. Read more
§

fn insert_request_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Insert a header into the request, if the header is not already present. Read more
§

fn override_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Insert a header into the response. Read more
§

fn append_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Append a header into the response. Read more
§

fn insert_response_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Insert a header into the response, if the header is not already present. Read more
§

fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>
where Self: Sized,

Catch panics and convert them into 500 Internal Server responses. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> Tried for T

Source§

fn try_add(self, rhs: Self) -> Result<Self>
where Self: CheckedAdd + Sized,

Adds rhs with checked arithmetic. Read more
Source§

fn try_sub(self, rhs: Self) -> Result<Self>
where Self: CheckedSub + Sized,

Subtracts rhs with checked arithmetic. Read more
Source§

fn try_mul(self, rhs: Self) -> Result<Self>
where Self: CheckedMul + Sized,

Multiplies by rhs with checked arithmetic. Read more
Source§

fn try_div(self, rhs: Self) -> Result<Self>
where Self: CheckedDiv + Sized,

Divides by rhs with checked arithmetic. Read more
Source§

fn try_rem(self, rhs: Self) -> Result<Self>
where Self: CheckedRem + Sized,

Computes the remainder by rhs with checked arithmetic. 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.
§

impl<T> WithSubscriber for T

§

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
§

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

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