Struct termimad::StyledChar
source · pub struct StyledChar { /* private fields */ }
Expand description
A modifiable character which can be easily written or repeated. Can be used for bullets, horizontal rules or quote marks.
Implementations§
source§impl StyledChar
impl StyledChar
pub fn new(compound_style: CompoundStyle, nude_char: char) -> StyledChar
pub fn nude(nude_char: char) -> StyledChar
pub fn nude_char(&self) -> char
pub fn from_fg_char(fg: Color, nude_char: char) -> StyledChar
pub const fn get_char(&self) -> char
sourcepub fn set_fg(&mut self, color: Color)
pub fn set_fg(&mut self, color: Color)
Change the fg color, keeping the char, bg color and attributes
pub const fn get_fg(&self) -> Option<Color>
sourcepub fn set_bg(&mut self, color: Color)
pub fn set_bg(&mut self, color: Color)
Change the bg color, keeping the char, fg color and attributes
pub const fn get_bg(&self) -> Option<Color>
sourcepub fn set_compound_style(&mut self, compound_style: CompoundStyle)
pub fn set_compound_style(&mut self, compound_style: CompoundStyle)
Change the style (colors, attributes) of the styled char
pub fn compound_style(&self) -> &CompoundStyle
sourcepub fn repeated(&self, count: usize) -> StyledContent<String>
pub fn repeated(&self, count: usize) -> StyledContent<String>
Return a struct implementing Display
, made of a (optimized) repetition
of the character with its style.
pub fn queue_repeat<W: Write>( &self, w: &mut W, count: usize ) -> Result<(), Error>
pub fn queue<W: Write>(&self, w: &mut W) -> Result<(), Error>
pub fn blend_with<C: Into<Color>>(&mut self, color: C, weight: f32)
Trait Implementations§
source§impl Clone for StyledChar
impl Clone for StyledChar
source§fn clone(&self) -> StyledChar
fn clone(&self) -> StyledChar
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for StyledChar
impl Debug for StyledChar
source§impl<'de> Deserialize<'de> for StyledChar
impl<'de> Deserialize<'de> for StyledChar
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for StyledChar
impl Display for StyledChar
source§impl From<StyledChar> for ScrollBarStyle
impl From<StyledChar> for ScrollBarStyle
source§fn from(sc: StyledChar) -> Self
fn from(sc: StyledChar) -> Self
Converts to this type from the input type.
source§impl PartialEq for StyledChar
impl PartialEq for StyledChar
source§fn eq(&self, other: &StyledChar) -> bool
fn eq(&self, other: &StyledChar) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PushStyleTokens for StyledChar
impl PushStyleTokens for StyledChar
fn push_style_tokens(&self, tokens: &mut Vec<StyleToken>)
fn to_style_tokens_string(&self) -> String
source§impl Serialize for StyledChar
impl Serialize for StyledChar
impl StructuralPartialEq for StyledChar
Auto Trait Implementations§
impl Freeze for StyledChar
impl RefUnwindSafe for StyledChar
impl Send for StyledChar
impl Sync for StyledChar
impl Unpin for StyledChar
impl UnwindSafe for StyledChar
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