pub struct Effects(/* private fields */);
Expand description
Implementations§
§impl Effects
impl Effects
pub const BOLD: Effects = _
pub const DIMMED: Effects = _
pub const DOUBLE_UNDERLINE: Effects = _
pub const CURLY_UNDERLINE: Effects = _
pub const DOTTED_UNDERLINE: Effects = _
pub const DASHED_UNDERLINE: Effects = _
pub const BLINK: Effects = _
pub const HIDDEN: Effects = _
pub const STRIKETHROUGH: Effects = _
pub const STRIKETHROUGH: Effects = _
Characters legible but marked as if for deletion. Not supported in Terminal.app
pub const fn is_plain(self) -> bool
pub const fn is_plain(self) -> bool
Check 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());
pub const fn contains(self, other: Effects) -> bool
pub const fn contains(self, other: Effects) -> bool
Returns true
if all of the effects in other
are contained within self
.
§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));
pub const fn insert(self, other: Effects) -> Effects
pub const fn insert(self, other: Effects) -> Effects
Inserts 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));
pub const fn remove(self, other: Effects) -> Effects
pub const fn remove(self, other: Effects) -> Effects
Removes 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));
pub const fn clear(self) -> Effects
pub const fn clear(self) -> Effects
Reset 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));
pub const fn set(self, other: Effects, enable: bool) -> Effects
pub const fn set(self, other: Effects, enable: bool) -> Effects
Enable 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));
pub fn iter(self) -> EffectIter ⓘ
pub fn iter(self) -> EffectIter ⓘ
Iterate over enabled effects
Trait Implementations§
§impl BitOr<Effects> for Style
impl BitOr<Effects> for Style
§Examples
let style = anstyle::Style::new() | anstyle::Effects::BOLD.into();
§impl BitOr for Effects
impl BitOr for Effects
§Examples
let effects = anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE;
assert_eq!(format!("{:?}", effects), "Effects(BOLD | UNDERLINE)");
§impl BitOrAssign<Effects> for Style
impl BitOrAssign<Effects> for Style
§Examples
let mut style = anstyle::Style::new();
style |= anstyle::Effects::BOLD.into();
§fn bitor_assign(&mut self, other: Effects)
fn bitor_assign(&mut self, other: Effects)
Performs the
|=
operation. Read more§impl BitOrAssign for Effects
impl BitOrAssign for Effects
§Examples
let mut effects = anstyle::Effects::BOLD;
effects |= anstyle::Effects::UNDERLINE;
assert_eq!(format!("{:?}", effects), "Effects(BOLD | UNDERLINE)");
§fn bitor_assign(&mut self, other: Effects)
fn bitor_assign(&mut self, other: Effects)
Performs the
|=
operation. Read more§impl Debug for Effects
impl Debug for Effects
§Examples
let effects = anstyle::Effects::new();
assert_eq!(format!("{:?}", effects), "Effects()");
let effects = anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE;
assert_eq!(format!("{:?}", effects), "Effects(BOLD | UNDERLINE)");
§impl Ord for Effects
impl Ord for Effects
§impl PartialEq<Effects> for Style
impl PartialEq<Effects> for Style
§Examples
let effects = anstyle::Effects::BOLD;
assert_eq!(anstyle::Style::new().effects(effects), effects);
assert_ne!(anstyle::Effects::UNDERLINE | effects, effects);
assert_ne!(anstyle::RgbColor(0, 0, 0).on_default() | effects, effects);
§impl PartialOrd for Effects
impl PartialOrd for Effects
§fn partial_cmp(&self, other: &Effects) -> Option<Ordering>
fn partial_cmp(&self, other: &Effects) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more§impl Sub<Effects> for Style
impl Sub<Effects> for Style
§Examples
let style = anstyle::Style::new().bold().underline() - anstyle::Effects::BOLD.into();
§impl Sub for Effects
impl Sub for Effects
§Examples
let effects = (anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE) - anstyle::Effects::BOLD;
assert_eq!(format!("{:?}", effects), "Effects(UNDERLINE)");
§impl SubAssign<Effects> for Style
impl SubAssign<Effects> for Style
§Examples
let mut style = anstyle::Style::new().bold().underline();
style -= anstyle::Effects::BOLD.into();
§fn sub_assign(&mut self, other: Effects)
fn sub_assign(&mut self, other: Effects)
Performs the
-=
operation. Read more§impl SubAssign for Effects
impl SubAssign for Effects
§Examples
let mut effects = anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE;
effects -= anstyle::Effects::BOLD;
assert_eq!(format!("{:?}", effects), "Effects(UNDERLINE)");
§fn sub_assign(&mut self, other: Effects)
fn sub_assign(&mut self, other: Effects)
Performs the
-=
operation. Read moreimpl Copy for Effects
impl Eq for Effects
impl StructuralEq for Effects
impl StructuralPartialEq for Effects
Auto Trait Implementations§
impl RefUnwindSafe for Effects
impl Send for Effects
impl Sync for Effects
impl Unpin for Effects
impl UnwindSafe for Effects
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
§impl<T> Clamp for Twhere
T: PartialOrd,
impl<T> Clamp for Twhere
T: PartialOrd,
§fn clamp_range(self, range: impl FixedRangeBounds<Self>) -> Selfwhere
Self: Clone,
fn clamp_range(self, range: impl FixedRangeBounds<Self>) -> Selfwhere
Self: Clone,
Clamps a value in range. Read more
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.