pub struct Tag { /* private fields */ }Available on crate feature
std only.Expand description
A resolved named style, returned by tag.
Holds a snapshot of the named style’s attributes (or none, for an unknown name), so it can render text without holding the registry lock.
Implementations§
Source§impl Tag
impl Tag
Sourcepub fn render_with(&self, text: &str) -> String
pub fn render_with(&self, text: &str) -> String
Render text with this named style, returning an owned String.
Color depth matches the terminal detected for standard output. For an unknown name the text is returned unchanged.
§Examples
use cli_forge::{define_tag, style, tag};
define_tag("warn", style("").yellow().bold());
let line = tag("warn").render_with("disk almost full");
assert!(line.contains("disk almost full"));Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tag
impl RefUnwindSafe for Tag
impl Send for Tag
impl Sync for Tag
impl Unpin for Tag
impl UnsafeUnpin for Tag
impl UnwindSafe for Tag
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
Mutably borrows from an owned value. Read more