pub struct Style { /* private fields */ }Expand description
A collection of CSS style properties that can be converted to a style string.
Implementations§
Source§impl Style
Implementation of style CSS serialization.
impl Style
Implementation of style CSS serialization.
Sourcepub fn to_css_string(&self) -> String
pub fn to_css_string(&self) -> String
Sourcepub fn create_style_string(props: &[(&str, &str)]) -> String
pub fn create_style_string(props: &[(&str, &str)]) -> String
Builds a CSS style string from an array of key-value pairs.
This function is used by the html! macro to convert static style:
attributes into a CSS string without allocating intermediate Style
and Vec<StyleProperty> objects. Keys are converted from snake_case
to kebab-case automatically.
§Arguments
&[(&str, &str)]- An array of CSS property name-value pairs.
§Returns
String- The CSS string (e.g.,"margin: 0 auto; max-width: 800px;").
Source§impl Style
impl Style
pub fn get_properties(&self) -> &Vec<StyleProperty>
pub fn set_properties(&mut self, val: Vec<StyleProperty>) -> &mut Self
pub fn get_mut_properties(&mut self) -> &mut Vec<StyleProperty>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Style
impl RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin for Style
impl UnsafeUnpin for Style
impl UnwindSafe for Style
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