Enum style::queries::condition::QueryCondition
source · pub enum QueryCondition {
Feature(QueryFeatureExpression),
Not(Box<QueryCondition>),
Operation(Box<[QueryCondition]>, Operator),
InParens(Box<QueryCondition>),
GeneralEnclosed(String),
}
Expand description
Represents a condition.
Variants§
Feature(QueryFeatureExpression)
A simple feature expression, implicitly parenthesized.
Not(Box<QueryCondition>)
A negation of a condition.
Operation(Box<[QueryCondition]>, Operator)
A set of joint operations.
InParens(Box<QueryCondition>)
A condition wrapped in parenthesis.
GeneralEnclosed(String)
[
Implementations§
source§impl QueryCondition
impl QueryCondition
sourcepub fn parse<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
feature_type: FeatureType,
) -> Result<Self, ParseError<'i>>
pub fn parse<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, feature_type: FeatureType, ) -> Result<Self, ParseError<'i>>
Parse a single condition.
fn visit<F>(&self, visitor: &mut F)
sourcepub fn cumulative_flags(&self) -> FeatureFlags
pub fn cumulative_flags(&self) -> FeatureFlags
Returns the union of all flags in the expression. This is useful for container queries.
sourcepub fn parse_disallow_or<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
feature_type: FeatureType,
) -> Result<Self, ParseError<'i>>
pub fn parse_disallow_or<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, feature_type: FeatureType, ) -> Result<Self, ParseError<'i>>
Parse a single condition, disallowing or
expressions.
To be used from the legacy query syntax.
sourcefn parse_internal<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
feature_type: FeatureType,
allow_or: AllowOr,
) -> Result<Self, ParseError<'i>>
fn parse_internal<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, feature_type: FeatureType, allow_or: AllowOr, ) -> Result<Self, ParseError<'i>>
https://drafts.csswg.org/mediaqueries-5/#typedef-media-condition or
https://drafts.csswg.org/mediaqueries-5/#typedef-media-condition-without-or
(depending on allow_or
).
fn parse_in_parenthesis_block<'i>( context: &ParserContext<'_>, input: &mut Parser<'i, '_>, feature_type: FeatureType, ) -> Result<Self, ParseError<'i>>
sourcepub fn parse_in_parens<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
feature_type: FeatureType,
) -> Result<Self, ParseError<'i>>
pub fn parse_in_parens<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, feature_type: FeatureType, ) -> Result<Self, ParseError<'i>>
Parse a condition in parentheses, or <general-enclosed>
.
https://drafts.csswg.org/mediaqueries/#typedef-media-in-parens
sourcepub fn matches(&self, context: &Context<'_>) -> KleeneValue
pub fn matches(&self, context: &Context<'_>) -> KleeneValue
Whether this condition matches the device and quirks mode.
https://drafts.csswg.org/mediaqueries/#evaluating
https://drafts.csswg.org/mediaqueries/#typedef-general-enclosed
Kleene 3-valued logic is adopted here due to the introduction of
Trait Implementations§
source§impl Clone for QueryCondition
impl Clone for QueryCondition
source§fn clone(&self) -> QueryCondition
fn clone(&self) -> QueryCondition
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for QueryCondition
impl Debug for QueryCondition
source§impl MallocSizeOf for QueryCondition
impl MallocSizeOf for QueryCondition
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl PartialEq for QueryCondition
impl PartialEq for QueryCondition
source§fn eq(&self, other: &QueryCondition) -> bool
fn eq(&self, other: &QueryCondition) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl ToCss for QueryCondition
impl ToCss for QueryCondition
source§impl ToShmem for QueryCondition
impl ToShmem for QueryCondition
impl StructuralPartialEq for QueryCondition
Auto Trait Implementations§
impl Freeze for QueryCondition
impl RefUnwindSafe for QueryCondition
impl Send for QueryCondition
impl Sync for QueryCondition
impl Unpin for QueryCondition
impl UnwindSafe for QueryCondition
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more