Skip to main content

StyleNode

Trait StyleNode 

Source
pub trait StyleNode {
    type Class: StyleNodeClass;
    type ClassIter<'a>: Iterator<Item = &'a Self::Class>
       where Self: 'a;

    // Required methods
    fn style_scope(&self) -> Option<NonZeroUsize>;
    fn extra_style_scope(&self) -> Option<NonZeroUsize>;
    fn host_style_scope(&self) -> Option<NonZeroUsize>;
    fn tag_name(&self) -> &str;
    fn id(&self) -> Option<&str>;
    fn classes(&self) -> Self::ClassIter<'_>;
    fn attribute(
        &self,
        name: &str,
    ) -> Option<(&str, StyleNodeAttributeCaseSensitivity)>;
    fn pseudo_element(&self) -> Option<PseudoElements>;

    // Provided method
    fn contain_scope(&self, scope: Option<NonZeroUsize>) -> bool { ... }
}
Expand description

A node descriptor for a style query.

Required Associated Types§

Source

type Class: StyleNodeClass

The type for a class.

Source

type ClassIter<'a>: Iterator<Item = &'a Self::Class> where Self: 'a

The type for classes iteration.

Required Methods§

Source

fn style_scope(&self) -> Option<NonZeroUsize>

The style scope of the node itself.

Source

fn extra_style_scope(&self) -> Option<NonZeroUsize>

The extra style scope of the node.

Source

fn host_style_scope(&self) -> Option<NonZeroUsize>

The extra style scope for the :host selector.

Source

fn tag_name(&self) -> &str

The tag name of the node.

Source

fn id(&self) -> Option<&str>

The id of the node.

Source

fn classes(&self) -> Self::ClassIter<'_>

The classes of the node.

Source

fn attribute( &self, name: &str, ) -> Option<(&str, StyleNodeAttributeCaseSensitivity)>

Get an attribute of the node.

Source

fn pseudo_element(&self) -> Option<PseudoElements>

The pseudo element to query.

Provided Methods§

Source

fn contain_scope(&self, scope: Option<NonZeroUsize>) -> bool

Check if the node has a specified scope.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a> StyleNode for StyleQuery<'a>

Source§

type Class = (String, Option<NonZero<usize>>)

Source§

type ClassIter<'c> = Iter<'c, <StyleQuery<'a> as StyleNode>::Class> where 'a: 'c

Source§

impl<'b, 'a: 'b> StyleNode for &'b StyleQuery<'a>

Source§

type Class = (String, Option<NonZero<usize>>)

Source§

type ClassIter<'c> = Iter<'c, <&'b StyleQuery<'a> as StyleNode>::Class> where 'b: 'c