pub struct Styled<T>where
T: Display,{
pub content: T,
pub style: StyleSheet,
}
Expand description
Represents a content that when rendered must have the associated style applied to it.
Fields§
§content: T
Content to be rendered.
style: StyleSheet
Style sheet to be applied to content when rendered.
Implementations§
Source§impl<T> Styled<T>where
T: Display,
impl<T> Styled<T>where
T: Display,
Sourcepub fn new(content: T) -> Styled<T>
pub fn new(content: T) -> Styled<T>
Creates a new Styled
object with the specified content
and a default (empty) style sheet.
Sourcepub fn with_style_sheet(self, style_sheet: StyleSheet) -> Styled<T>
pub fn with_style_sheet(self, style_sheet: StyleSheet) -> Styled<T>
Sets the style sheet to the styled struct.
Sourcepub fn with_fg(self, fg: Color) -> Styled<T>
pub fn with_fg(self, fg: Color) -> Styled<T>
Sets the styled content to have the defined foreground Color.
Sourcepub fn with_bg(self, bg: Color) -> Styled<T>
pub fn with_bg(self, bg: Color) -> Styled<T>
Sets the styled content to have the defined foreground Color.
Sourcepub fn with_attr(self, attributes: Attributes) -> Styled<T>
pub fn with_attr(self, attributes: Attributes) -> Styled<T>
Sets the styled content to have the defined attributes.
Warning: this does not keep the previously applied attributes. If you want to just set a new attribute and keep the others, you need to apply the OR operation yourself.
Trait Implementations§
impl<T> Copy for Styled<T>
Auto Trait Implementations§
impl<T> Freeze for Styled<T>where
T: Freeze,
impl<T> RefUnwindSafe for Styled<T>where
T: RefUnwindSafe,
impl<T> Send for Styled<T>where
T: Send,
impl<T> Sync for Styled<T>where
T: Sync,
impl<T> Unpin for Styled<T>where
T: Unpin,
impl<T> UnwindSafe for Styled<T>where
T: UnwindSafe,
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