Skip to main content

impl_style_methods

Macro impl_style_methods 

Source
macro_rules! impl_style_methods {
    ($ty:ty, $push:expr) => { ... };
}
Expand description

Macro to implement styling methods on a type.

This macro generates all the styling methods (color, bold, italic, etc.) for a given type. The type must have a way to accumulate StyleActions.

§Parameters

  • $ty: The type to implement styling methods for.
  • $push: A closure that takes the type and a StyleAction, and returns the modified type.

§Example

impl_style_methods!(Cell, |mut cell: Cell, action| {
    cell.styles.push(action);
    cell
});