pub struct StyleSheet {
pub rules: Vec<CssRule>,
pub media_rules: Vec<MediaRule>,
pub keyframes_rules: Vec<KeyframesRule>,
}Expand description
A parsed stylesheet (list of rules).
Fields§
§rules: Vec<CssRule>§media_rules: Vec<MediaRule>✅ 新增:@media 规则列表
keyframes_rules: Vec<KeyframesRule>✅ 新增:@keyframes 规则列表
Implementations§
Source§impl StyleSheet
impl StyleSheet
Sourcepub fn declarations_for_class(&self, class: &str) -> Vec<Declaration>
pub fn declarations_for_class(&self, class: &str) -> Vec<Declaration>
Query all declarations matching a given class name.
Sourcepub fn declarations_for_tag(&self, tag: &str) -> Vec<Declaration>
pub fn declarations_for_tag(&self, tag: &str) -> Vec<Declaration>
Query all declarations matching a given tag name.
Sourcepub fn compute(&self, classes: &[String], tag: &str) -> HashMap<String, String>
pub fn compute(&self, classes: &[String], tag: &str) -> HashMap<String, String>
Compute the full set of resolved declarations for a set of class names and tag.
Sourcepub fn compute_with_media(
&self,
classes: &[String],
tag: &str,
viewport_width: f32,
viewport_height: f32,
) -> HashMap<String, String>
pub fn compute_with_media( &self, classes: &[String], tag: &str, viewport_width: f32, viewport_height: f32, ) -> HashMap<String, String>
✅ 新增:获取匹配当前视口的 @media 规则中的样式
Sourcepub fn get_keyframes(&self, name: &str) -> Option<&KeyframesRule>
pub fn get_keyframes(&self, name: &str) -> Option<&KeyframesRule>
✅ 新增:获取指定名称的 @keyframes 规则
Trait Implementations§
Source§impl Clone for StyleSheet
impl Clone for StyleSheet
Source§fn clone(&self) -> StyleSheet
fn clone(&self) -> StyleSheet
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StyleSheet
impl Debug for StyleSheet
Source§impl Default for StyleSheet
impl Default for StyleSheet
Source§fn default() -> StyleSheet
fn default() -> StyleSheet
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StyleSheet
impl RefUnwindSafe for StyleSheet
impl Send for StyleSheet
impl Sync for StyleSheet
impl Unpin for StyleSheet
impl UnsafeUnpin for StyleSheet
impl UnwindSafe for StyleSheet
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