fluent-ansi 0.3.0

A fluent interface for ANSI terminal colors and styles in Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use core::fmt::Display;

use crate::{Style, Styled, ToStyle, ToStyleSet};

/// A trait to apply styling to some content.
pub trait AppliedTo: ToStyle + ToStyleSet<StyleSet = Style> {
    /// Applies the styling to the given content, returning a [`Styled<C>`](Styled) instance.
    #[must_use]
    fn applied_to<C: Display>(self, content: C) -> Styled<C> {
        self.to_style().applied_to(content)
    }
}