Implement styler traits for &'a str (#449)

This commit is contained in:
Max Sharnoff 2020-07-06 18:46:43 +01:00 committed by GitHub
parent 9d9dfeae26
commit 13e0d012ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -160,13 +160,23 @@ where
}
impl_colorize!(String);
impl_colorize!(&'static str);
impl_colorize!(char);
// We do actually need the parentheses here because the macro doesn't work without them otherwise
// This is probably a bug somewhere in the compiler, but it isn't that big a deal.
#[allow(unused_parens)]
impl<'a> Colorize<&'a str> for &'a str {
impl_colorize_callback!(def_color_base!((&'a str)));
}
impl_styler!(String);
impl_styler!(&'static str);
impl_styler!(char);
#[allow(unused_parens)]
impl<'a> Styler<&'a str> for &'a str {
impl_styler_callback!(def_attr_base!((&'a str)));
}
/// Returns available color count.
///
/// # Notes