-
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allowed font_style to be an array #124
Conversation
This allows multiple `font_style`s to be used, allowing, say, for a bold and italic text. Fixes sharkdp#49
This allows multiple `font_style`s to be used, allowing, say, for a bold and italic text. Fixes sharkdp#49
4d2cdb9
to
cd2298e
Compare
…nto multiple_font_styles
This removes a trailing semicolon that can occur in some positions
for (i, style) in self.0.iter().enumerate() { | ||
if i + 1 == self.0.len() { | ||
write!(f, "{}", style)?; | ||
} else { | ||
write!(f, "{};", style)?; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to use https://doc.rust-lang.org/std/primitive.slice.html#method.join here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, because that would only work if the slice was a slice of str
s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, right. we could use intersperse from itertools, but it's not worth a new dependency. Maybe once it is stabilized in std
😄 (rust-lang/rust#79524, https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.intersperse)
Thank you for the update |
This allows multiple
font_style
s to be used, allowing, say, for a bold and italic text. Fixes #49All previous examples should work, but now you can also specify: