pub trait QueryCondition: Sized + ToCss {
type Feature;
Show 15 methods
// Required methods
fn parse_feature(input: &mut Parser<'_>) -> Result<Self>;
fn parse_style_query(input: &mut Parser<'_>) -> Result<Self>;
fn needs_parens(
&self,
parent_operator: Option<Operator>,
targets: &Targets,
) -> bool;
fn as_feature(&self) -> Option<&Self::Feature>;
fn as_not(&self) -> Option<&Self>;
fn as_operation(&self) -> Option<(Operator, &[Self])>;
fn feature_to_css(
f: &Self::Feature,
dest: &mut Printer<'_>,
) -> Result<(), PrintErr>;
// Provided methods
fn parse_feature_with_options(
input: &mut Parser<'_>,
_options: &ParserOptions<'_>,
) -> Result<Self> { ... }
fn create_negation(condition: Box<Self>) -> Self { ... }
fn create_negation_in(condition: Self, _alloc: ArenaPtr) -> Self { ... }
fn create_operation(operator: Operator, conditions: Vec<Self>) -> Self { ... }
fn create_operation_in(
operator: Operator,
conditions: ArenaVec<Self>,
) -> Self { ... }
fn parse_style_query_with_options(
input: &mut Parser<'_>,
_options: &ParserOptions<'_>,
) -> Result<Self> { ... }
fn extra_to_css(&self, _dest: &mut Printer<'_>) -> Result<(), PrintErr> { ... }
fn condition_to_css(&self, dest: &mut Printer<'_>) -> Result<(), PrintErr> { ... }
}Expand description
Trait modeling Zig’s ValidQueryCondition comptime interface check.
Any type that can appear as a node in a query-condition tree.
Required Associated Types§
Required Methods§
fn parse_feature(input: &mut Parser<'_>) -> Result<Self>
fn parse_style_query(input: &mut Parser<'_>) -> Result<Self>
fn needs_parens( &self, parent_operator: Option<Operator>, targets: &Targets, ) -> bool
fn as_feature(&self) -> Option<&Self::Feature>
fn as_not(&self) -> Option<&Self>
fn as_operation(&self) -> Option<(Operator, &[Self])>
Provided Methods§
Sourcefn parse_feature_with_options(
input: &mut Parser<'_>,
_options: &ParserOptions<'_>,
) -> Result<Self>
fn parse_feature_with_options( input: &mut Parser<'_>, _options: &ParserOptions<'_>, ) -> Result<Self>
parse_feature with ParserOptions threaded — needed for the
env() arm of MediaFeatureValue::parse_unknown. Default impl
drops options so out-of-tree implementors (e.g.
rules::container::{ContainerCondition,StyleQuery}) keep compiling
until they opt in.
fn create_negation(condition: Box<Self>) -> Self
fn create_negation_in(condition: Self, _alloc: ArenaPtr) -> Self
fn create_operation(operator: Operator, conditions: Vec<Self>) -> Self
fn create_operation_in(operator: Operator, conditions: ArenaVec<Self>) -> Self
Sourcefn parse_style_query_with_options(
input: &mut Parser<'_>,
_options: &ParserOptions<'_>,
) -> Result<Self>
fn parse_style_query_with_options( input: &mut Parser<'_>, _options: &ParserOptions<'_>, ) -> Result<Self>
See parse_feature_with_options — same default-forward rationale.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".