pub struct StyleRule {
pub selector: StyleSelectors,
pub attributes: StyleAttributes,
}
Expand description
A Stylesheet
rule.
A rule is a selector and a list of attributes. The attributes are applied to the elements that match the selector.
Fields§
§selector: StyleSelectors
§attributes: StyleAttributes
Implementations§
source§impl StyleRule
impl StyleRule
sourcepub fn new(selector: StyleSelectors) -> Self
pub fn new(selector: StyleSelectors) -> Self
Creates a new style rule from StyleSelectors
.
sourcepub fn add_attribute(&mut self, attribute: StyleAttribute)
pub fn add_attribute(&mut self, attribute: StyleAttribute)
Adds an StyleAttribute
to the rule.
sourcepub fn add_attributes(&mut self, attributes: Vec<StyleAttribute>)
pub fn add_attributes(&mut self, attributes: Vec<StyleAttribute>)
Adds a list of StyleAttribute
s to the rule.
sourcepub fn get_attribute(&self, name: &str) -> Option<&StyleAttribute>
pub fn get_attribute(&self, name: &str) -> Option<&StyleAttribute>
Gets the value of an attribute.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for StyleRule
impl Send for StyleRule
impl Sync for StyleRule
impl Unpin for StyleRule
impl UnwindSafe for StyleRule
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> Styleable<T> for T
impl<T> Styleable<T> for T
source§fn styled(self) -> Styled<T>
fn styled(self) -> Styled<T>
Converts the
self
into a Styled<Self>
value.source§fn attr_trans(
self,
key: &str,
value: impl Into<StyleAttributeValue>,
transition: impl Into<StyleTransition>
) -> Styled<T>
fn attr_trans( self, key: &str, value: impl Into<StyleAttributeValue>, transition: impl Into<StyleTransition> ) -> Styled<T>
Adds an attribute with a transition.