pub struct Property { /* private fields */ }Expand description
Represents a single CSS property with a name and value.
A Property is the fundamental building block of CSS styles in this library.
Each property has a name (like “color” or “margin-top”) and a value that has
been converted to a string representation.
Properties are typically created using the functions in the submodules of this module, rather than being constructed directly.
§Examples
use mew_css::properties::Property;
// Create a property directly
let color_prop = Property::new("color", "blue");
let font_size_prop = Property::new("font-size", "16px");
// The string representation includes the semicolon
assert_eq!(color_prop.to_string(), "color: blue;");Implementations§
Source§impl Property
impl Property
Sourcepub fn new<T: Display>(name: &str, value: T) -> Self
pub fn new<T: Display>(name: &str, value: T) -> Self
Creates a new CSS property with the given name and value.
This method converts the value to a string using the Display trait.
§Arguments
name- The CSS property namevalue- The property value, which can be any type that implementsDisplay
§Returns
A new Property instance
§Examples
use mew_css::properties::Property;
let color_prop = Property::new("color", "blue");
let margin_prop = Property::new("margin", "10px");
let opacity_prop = Property::new("opacity", 0.5);Trait Implementations§
Auto Trait Implementations§
impl Freeze for Property
impl RefUnwindSafe for Property
impl Send for Property
impl Sync for Property
impl Unpin for Property
impl UnwindSafe for Property
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