mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-05-30 15:42:25 +00:00
1.6 KiB
1.6 KiB
name, group, category, update-time, description, key-word
| name | group | category | update-time | description | key-word | ||||
|---|---|---|---|---|---|---|---|---|---|
| color-support-label | api | formatter | 20260520 | Convert a ColorSupport value into its stable string label. |
|
Color-support-label
Convert ColorSupport into its stable string label. This helper is useful for diagnostics, tests, and config-oriented output that should mirror the built-in color support names.
Interface
pub fn color_support_label(support : ColorSupport) -> String {
input
support : ColorSupport- Color support enum value to label.
output
String- Stable label such asbasicortruecolor.
Explanation
Detailed rules explaining key parameters and behaviors
- The returned strings are stable enum labels used by config and tests.
- This helper is presentation-oriented and does not change formatter behavior by itself.
- It is useful when code should display or assert a readable color support mode.
How to Use
Here are some specific examples provided.
When Need A Readable Color Support Name
When diagnostics or tests should show the selected color capability:
let label = color_support_label(ColorSupport::Basic)
In this example, label becomes "basic".
Error Case
e.g.:
-
There is no failure path for valid
ColorSupportvalues. -
If code needs to choose rendering behavior, the enum value itself is usually more useful than its label string.
Notes
-
This helper is mostly useful for readable output and assertions.
-
It pairs naturally with config parsing and formatter inspection tests.