pub struct Text { /* private fields */ }Expand description
A piece of text, may be colored, etc
Implementations§
Source§impl Text
impl Text
Sourcepub fn new(t: String) -> Text
pub fn new(t: String) -> Text
Instantiate the Text as just plain text.
Use the builder pattern to construct the rest.
§Examples
use termstyle::{Color, Text};
let t = Text::new("bold and blue text".into())
.bold()
.color(Color::Blue);
// write it to stdout
t.paint(&mut ::std::io::stdout()).unwrap();pub fn paint<W: Write>(&self, w: &mut W) -> Result<()>
pub fn is_bold(&self) -> bool
pub fn is_italic(&self) -> bool
pub fn is_plain(&self) -> bool
pub fn get_color(&self) -> Color
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Text
impl<'de> Deserialize<'de> for Text
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
impl Eq for Text
impl StructuralPartialEq for Text
Auto Trait Implementations§
impl Freeze for Text
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnwindSafe for Text
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