fluent-ansi 0.1.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::{Format, Formatted, ToFormat, ToFormatSet};

/// A trait to apply a formatting to some content.
pub trait AppliedTo: ToFormat + ToFormatSet<FormatSet = Format> {
    /// Applies the formatting to the given content, returning a [`Formatted<C>`](Formatted) instance.
    #[must_use]
    fn applied_to<C: Display>(self, content: C) -> Formatted<C> {
        self.to_format().applied_to(content)
    }
}