Struct selectors::parser::SelectorList

source ·
pub struct SelectorList<Impl: SelectorImpl>(ThinArcUnion<SpecificityAndFlags, Component<Impl>, (), Selector<Impl>>);
Expand description

A selector list is a tagged pointer with either a single selector, or a ThinArc<()> of multiple selectors.

Tuple Fields§

§0: ThinArcUnion<SpecificityAndFlags, Component<Impl>, (), Selector<Impl>>

Implementations§

source§

impl<Impl: SelectorImpl> SelectorList<Impl>

source

pub fn mark_as_intentionally_leaked(&self)

See Arc::mark_as_intentionally_leaked

source

pub fn from_one(selector: Selector<Impl>) -> Self

source

pub fn from_iter(iter: impl ExactSizeIterator<Item = Selector<Impl>>) -> Self

source

pub fn slice(&self) -> &[Selector<Impl>]

source

pub fn len(&self) -> usize

source

pub fn thin_arc_heap_ptr(&self) -> *const c_void

Returns the address on the heap of the ThinArc for memory reporting.

source§

impl<Impl: SelectorImpl> SelectorList<Impl>

source

pub fn scope() -> Self

Returns a selector list with a single :scope selector (with specificity)

source

pub fn implicit_scope() -> Self

Returns a selector list with a single implicit :scope selector (no specificity)

source

pub fn parse<'i, 't, P>( parser: &P, input: &mut CssParser<'i, 't>, parse_relative: ParseRelative, ) -> Result<Self, ParseError<'i, P::Error>>
where P: Parser<'i, Impl = Impl>,

Parse a comma-separated list of Selectors. https://drafts.csswg.org/selectors/#grouping

Return the Selectors or Err if there is an invalid selector.

source

pub fn parse_disallow_pseudo<'i, 't, P>( parser: &P, input: &mut CssParser<'i, 't>, parse_relative: ParseRelative, ) -> Result<Self, ParseError<'i, P::Error>>
where P: Parser<'i, Impl = Impl>,

Same as parse, but disallow parsing of pseudo-elements.

source

pub fn parse_forgiving<'i, 't, P>( parser: &P, input: &mut CssParser<'i, 't>, parse_relative: ParseRelative, ) -> Result<Self, ParseError<'i, P::Error>>
where P: Parser<'i, Impl = Impl>,

source

fn parse_with_state<'i, 't, P>( parser: &P, input: &mut CssParser<'i, 't>, state: SelectorParsingState, recovery: ForgivingParsing, parse_relative: ParseRelative, ) -> Result<Self, ParseError<'i, P::Error>>
where P: Parser<'i, Impl = Impl>,

source

pub fn replace_parent_selector(&self, parent: &SelectorList<Impl>) -> Self

Replaces the parent selector in all the items of the selector list.

source

pub(crate) fn from_vec(v: Vec<Selector<Impl>>) -> Self

Creates a SelectorList from a Vec of selectors. Used in tests.

Trait Implementations§

source§

impl<Impl: Clone + SelectorImpl> Clone for SelectorList<Impl>

source§

fn clone(&self) -> SelectorList<Impl>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Impl: Debug + SelectorImpl> Debug for SelectorList<Impl>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Impl: PartialEq + SelectorImpl> PartialEq for SelectorList<Impl>

source§

fn eq(&self, other: &SelectorList<Impl>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Impl: SelectorImpl> ToCss for SelectorList<Impl>

source§

fn to_css<W>(&self, dest: &mut W) -> Result
where W: Write,

Serialize self in CSS syntax, writing to dest.
source§

fn to_css_string(&self) -> String

Serialize self in CSS syntax and return a string. Read more
source§

impl<Impl: SelectorImpl> ToShmem for SelectorList<Impl>

source§

fn to_shmem(&self, builder: &mut SharedMemoryBuilder) -> Result<Self>

Clones this value into a form suitable for writing into a SharedMemoryBuilder. Read more
source§

impl<Impl: Eq + SelectorImpl> Eq for SelectorList<Impl>

source§

impl<Impl: SelectorImpl> StructuralPartialEq for SelectorList<Impl>

Auto Trait Implementations§

§

impl<Impl> Freeze for SelectorList<Impl>

§

impl<Impl> RefUnwindSafe for SelectorList<Impl>

§

impl<Impl> Send for SelectorList<Impl>

§

impl<Impl> Sync for SelectorList<Impl>

§

impl<Impl> Unpin for SelectorList<Impl>

§

impl<Impl> UnwindSafe for SelectorList<Impl>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.