selectors/*.rs - Put all the to_shmem attributes behind a "shmem" feature

This commit is contained in:
Federico Mena Quintero 2023-02-14 11:39:37 -06:00
parent 9dae402dc5
commit c78af6a32f
4 changed files with 48 additions and 33 deletions

View file

@ -6,15 +6,16 @@ use crate::parser::SelectorImpl;
use cssparser::ToCss;
use std::fmt;
#[derive(Clone, Eq, PartialEq, ToShmem)]
#[shmem(no_bounds)]
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(feature = "shmem", derive(ToShmem))]
#[cfg_attr(feature = "shmem", shmem(no_bounds))]
pub struct AttrSelectorWithOptionalNamespace<Impl: SelectorImpl> {
#[shmem(field_bound)]
#[cfg_attr(feature = "shmem", shmem(field_bound))]
pub namespace: Option<NamespaceConstraint<(Impl::NamespacePrefix, Impl::NamespaceUrl)>>,
#[shmem(field_bound)]
#[cfg_attr(feature = "shmem", shmem(field_bound))]
pub local_name: Impl::LocalName,
pub local_name_lower: Impl::LocalName,
#[shmem(field_bound)]
#[cfg_attr(feature = "shmem", shmem(field_bound))]
pub operation: ParsedAttrSelectorOperation<Impl::AttrValue>,
pub never_matches: bool,
}
@ -28,7 +29,8 @@ impl<Impl: SelectorImpl> AttrSelectorWithOptionalNamespace<Impl> {
}
}
#[derive(Clone, Eq, PartialEq, ToShmem)]
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(feature = "shmem", derive(ToShmem))]
pub enum NamespaceConstraint<NamespaceUrl> {
Any,
@ -36,7 +38,8 @@ pub enum NamespaceConstraint<NamespaceUrl> {
Specific(NamespaceUrl),
}
#[derive(Clone, Eq, PartialEq, ToShmem)]
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(feature = "shmem", derive(ToShmem))]
pub enum ParsedAttrSelectorOperation<AttrValue> {
Exists,
WithValue {
@ -76,7 +79,8 @@ impl<AttrValue> AttrSelectorOperation<AttrValue> {
}
}
#[derive(Clone, Copy, Eq, PartialEq, ToShmem)]
#[derive(Clone, Copy, Eq, PartialEq)]
#[cfg_attr(feature = "shmem", derive(ToShmem))]
pub enum AttrSelectorOperator {
Equal,
Includes,
@ -136,7 +140,8 @@ impl AttrSelectorOperator {
/// The definition of whitespace per CSS Selectors Level 3 § 4.
pub static SELECTOR_WHITESPACE: &[char] = &[' ', '\t', '\n', '\r', '\x0C'];
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToShmem)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "shmem", derive(ToShmem))]
pub enum ParsedCaseSensitivity {
// 's' was specified.
ExplicitCaseSensitive,