pub struct LineStyle {
pub compound_style: CompoundStyle,
pub align: Alignment,
pub left_margin: usize,
pub right_margin: usize,
}
Expand description
A style applicable to a type of line.
It’s made of
- the base style of the compounds
- the alignment
Fields§
§compound_style: CompoundStyle
§align: Alignment
§left_margin: usize
§right_margin: usize
Implementations§
source§impl LineStyle
impl LineStyle
sourcepub fn margins_in(&self, available_width: Option<usize>) -> (usize, usize)
pub fn margins_in(&self, available_width: Option<usize>) -> (usize, usize)
Return a (left_margin, right_margin) tupple, with both values being zeroed when they wouldn’t let a width of at least 3 otherwise.
pub fn new(compound_style: CompoundStyle, align: Alignment) -> Self
sourcepub fn repeat_string(
&self,
f: &mut Formatter<'_>,
s: &str,
count: usize
) -> Result
pub fn repeat_string( &self, f: &mut Formatter<'_>, s: &str, count: usize ) -> Result
Write a string several times with the line compound style
sourcepub fn repeat_char(
&self,
f: &mut Formatter<'_>,
c: char,
count: usize
) -> Result
pub fn repeat_char( &self, f: &mut Formatter<'_>, c: char, count: usize ) -> Result
Write a string several times with the line compound style
sourcepub fn repeat_space(&self, f: &mut Formatter<'_>, count: usize) -> Result
pub fn repeat_space(&self, f: &mut Formatter<'_>, count: usize) -> Result
Write 0 or more spaces with the line’s compound style
pub fn blend_with<C: Into<Color>>(&mut self, color: C, weight: f32)
Trait Implementations§
source§impl<'de> Deserialize<'de> for LineStyle
impl<'de> Deserialize<'de> for LineStyle
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 From<&[StyleToken]> for LineStyle
impl From<&[StyleToken]> for LineStyle
source§fn from(tokens: &[StyleToken]) -> Self
fn from(tokens: &[StyleToken]) -> Self
Converts to this type from the input type.
source§impl From<CompoundStyle> for LineStyle
impl From<CompoundStyle> for LineStyle
source§fn from(compound_style: CompoundStyle) -> Self
fn from(compound_style: CompoundStyle) -> Self
Converts to this type from the input type.
source§impl PartialEq for LineStyle
impl PartialEq for LineStyle
source§impl PushStyleTokens for LineStyle
impl PushStyleTokens for LineStyle
fn push_style_tokens(&self, tokens: &mut Vec<StyleToken>)
fn to_style_tokens_string(&self) -> String
impl StructuralPartialEq for LineStyle
Auto Trait Implementations§
impl Freeze for LineStyle
impl RefUnwindSafe for LineStyle
impl Send for LineStyle
impl Sync for LineStyle
impl Unpin for LineStyle
impl UnwindSafe for LineStyle
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