pub struct Styles { /* private fields */ }
Expand description
Styles that can be combined and applied to a Span
.
The RESET
flag is missing because the parser implemented in SpanIter
takes care of it for you.
See wiki.vg’s docs for detailed info about each style.
§Examples
use mc_legacy_formatting::Styles;
let styles = Styles::BOLD | Styles::ITALIC | Styles::UNDERLINED;
assert!(styles.contains(Styles::BOLD));
assert!(!styles.contains(Styles::RANDOM));
Implementations§
Source§impl Styles
impl Styles
Sourcepub const RANDOM: Styles
pub const RANDOM: Styles
Signals that the Span
’s text should be replaced with randomized
characters at a constant interval
Sourcepub const STRIKETHROUGH: Styles
pub const STRIKETHROUGH: Styles
Signals that the Span
’s text should be strikethrough
Sourcepub const UNDERLINED: Styles
pub const UNDERLINED: Styles
Signals that the Span
’s text should be underlined
Sourcepub fn from_bits(bits: u32) -> Option<Styles>
pub fn from_bits(bits: u32) -> Option<Styles>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
Sourcepub const fn from_bits_truncate(bits: u32) -> Styles
pub const fn from_bits_truncate(bits: u32) -> Styles
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
Sourcepub const unsafe fn from_bits_unchecked(bits: u32) -> Styles
pub const unsafe fn from_bits_unchecked(bits: u32) -> Styles
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
Sourcepub const fn intersects(&self, other: Styles) -> bool
pub const fn intersects(&self, other: Styles) -> bool
Returns true
if there are flags common to both self
and other
.
Trait Implementations§
Source§impl BitAndAssign for Styles
impl BitAndAssign for Styles
Source§fn bitand_assign(&mut self, other: Styles)
fn bitand_assign(&mut self, other: Styles)
Disables all flags disabled in the set.
Source§impl BitOrAssign for Styles
impl BitOrAssign for Styles
Source§fn bitor_assign(&mut self, other: Styles)
fn bitor_assign(&mut self, other: Styles)
Adds the set of flags.
Source§impl BitXorAssign for Styles
impl BitXorAssign for Styles
Source§fn bitxor_assign(&mut self, other: Styles)
fn bitxor_assign(&mut self, other: Styles)
Toggles the set of flags.
Source§impl Extend<Styles> for Styles
impl Extend<Styles> for Styles
Source§fn extend<T: IntoIterator<Item = Styles>>(&mut self, iterator: T)
fn extend<T: IntoIterator<Item = Styles>>(&mut self, iterator: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl FromIterator<Styles> for Styles
impl FromIterator<Styles> for Styles
Source§impl Ord for Styles
impl Ord for Styles
Source§impl PartialOrd for Styles
impl PartialOrd for Styles
Source§impl SubAssign for Styles
impl SubAssign for Styles
Source§fn sub_assign(&mut self, other: Styles)
fn sub_assign(&mut self, other: Styles)
Disables all flags enabled in the set.