Skip to content

struct

Rule

pub struct Rule {
    pub class: String,
    pub selector: String,
    pub declarations: Vec<(String, String)>,
    pub media: Vec<String>,
    pub keyframes: Option<&'static str>,
    pub font_face: Option<String>,
    pub key: SortKey,
}

A generated CSS rule for one class.

Fields

class

pub class: String

The class it was generated for.

selector

pub selector: String

The CSS selector.

declarations

pub declarations: Vec<(String, String)>

The declarations, as (property, value) pairs.

media

pub media: Vec<String>

Media queries (or @container … at-rules), outermost first.

keyframes

pub keyframes: Option<&'static str>

An @keyframes rule the class needs (animate-spin).

font_face

pub font_face: Option<String>

An @font-face rule the class needs (font-[/fonts/x.woff2]).

key

pub key: SortKey

Where it goes in the stylesheet.

Methods

to_css

pub fn to_css(&self) -> String

The rule as CSS: its selector (with variants), wrapped in any media queries.

Trait implementations