Struct Effects
pub struct Effects(/* private field */);
A set of text effects
Examples
let effects = anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE;
Implementations
impl Effects
const BOLD: Self = _;const DIMMED: Self = _;const ITALIC: Self = _;Not widely supported. Sometimes treated as inverse or blink
const UNDERLINE: Self = _;Style extensions exist for Kitty, VTE, mintty and iTerm2.
const DOUBLE_UNDERLINE: Self = _;const CURLY_UNDERLINE: Self = _;const DOTTED_UNDERLINE: Self = _;const DASHED_UNDERLINE: Self = _;const BLINK: Self = _;const INVERT: Self = _;Swap foreground and background colors; inconsistent emulation
const HIDDEN: Self = _;const STRIKETHROUGH: Self = _;Characters legible but marked as if for deletion. Not supported in Terminal.app
const fn new() -> SelfNo effects enabled
Examples
let effects = anstyle::Effects::new();const fn is_plain(self) -> boolCheck if no effects are enabled
Examples
let effects = anstyle::Effects::new(); assert!(effects.is_plain()); let effects = anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE; assert!(!effects.is_plain());const fn contains(self, other: Effects) -> boolReturns
trueif all of the effects inotherare contained withinself.Examples
let effects = anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE; assert!(effects.contains(anstyle::Effects::BOLD)); let effects = anstyle::Effects::new(); assert!(!effects.contains(anstyle::Effects::BOLD));const fn insert(self, other: Effects) -> SelfInserts the specified effects in-place.
Examples
let effects = anstyle::Effects::new().insert(anstyle::Effects::new()); assert!(effects.is_plain()); let effects = anstyle::Effects::new().insert(anstyle::Effects::BOLD); assert!(effects.contains(anstyle::Effects::BOLD));const fn remove(self, other: Effects) -> SelfRemoves the specified effects in-place.
Examples
let effects = (anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE).remove(anstyle::Effects::BOLD); assert!(!effects.contains(anstyle::Effects::BOLD)); assert!(effects.contains(anstyle::Effects::UNDERLINE));const fn clear(self) -> SelfReset all effects in-place
let effects = (anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE).clear(); assert!(!effects.contains(anstyle::Effects::BOLD)); assert!(!effects.contains(anstyle::Effects::UNDERLINE));const fn set(self, other: Self, enable: bool) -> SelfEnable or disable the specified effects depending on the passed value.
Examples
let effects = anstyle::Effects::new().set(anstyle::Effects::BOLD, true); assert!(effects.contains(anstyle::Effects::BOLD));fn iter(self) -> EffectIterIterate over enabled effects
fn render(self) -> impl Display + CopyRender the ANSI code
Trait Implementations
impl BitOr for Effects
type Output = Effects;fn bitor(self, rhs: Self) -> Self
impl BitOrAssign for Effects
fn bitor_assign(&mut self, other: Self)
impl Clone for Effects
fn clone(&self) -> Self
impl Copy for Effects
impl Debug for Effects
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for Effects
fn default() -> Self
impl Eq for Effects
impl Hash for Effects
fn hash<__H: Hasher>(&self, state: &mut __H)
impl Ord for Effects
fn cmp(&self, other: &Self) -> Ordering
impl PartialEq for Effects
fn eq(&self, other: &Self) -> bool
impl PartialOrd for Effects
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
impl StructuralPartialEq for Effects
impl Sub for Effects
type Output = Effects;fn sub(self, other: Self) -> Self
impl SubAssign for Effects
fn sub_assign(&mut self, other: Self)