pub trait Parse: Sized {
// Required method
fn parse<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>>;
}
Expand description
A trait to abstract parsing of a specified value given a ParserContext
and
CSS input.
This can be derived on keywords with #[derive(Parse)]
.
The derive code understands the following attributes on each of the variants:
-
#[parse(aliases = "foo,bar")]
can be used to alias a value with another at parse-time. -
#[parse(condition = "function")]
can be used to make the parsing of the value conditional onfunction
, which needs to fulfillfn(&ParserContext) -> bool
. -
#[parse(parse_fn = "function")]
can be used to specify a function other than Parser::parse for a particular variant.
Required Methods§
sourcefn parse<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>>
fn parse<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>>
Parse a value of this type.
Returns an error on failure.
Object Safety§
Implementations on Foreign Types§
source§impl Parse for UnicodeRange
impl Parse for UnicodeRange
fn parse<'i, 't>( _: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>>
source§impl<T> Parse for Box<T>where
T: Parse,
impl<T> Parse for Box<T>where
T: Parse,
fn parse<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>>
source§impl<T> Parse for Vec<T>
impl<T> Parse for Vec<T>
fn parse<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>>
Implementors§
impl Parse for ColorSpace
impl Parse for HueInterpolationMethod
impl Parse for ChannelKeyword
impl Parse for SpeakAs
impl Parse for Symbol
impl Parse for SymbolsType
impl Parse for System
impl Parse for FontDisplay
impl Parse for FontFaceSourceFormatKeyword
impl Parse for style::font_face::FontStyle
impl Parse for Source
impl Parse for Qualifier
impl Parse for style::properties::generated::longhands::_servo_overflow_clip_box::computed_value::T
impl Parse for style::properties::generated::longhands::_servo_top_layer::computed_value::T
impl Parse for style::properties::generated::longhands::backface_visibility::computed_value::T
impl Parse for style::properties::generated::longhands::background_attachment::single_value::computed_value::T
impl Parse for style::properties::generated::longhands::background_clip::single_value::computed_value::T
impl Parse for style::properties::generated::longhands::background_origin::single_value::computed_value::T
impl Parse for style::properties::generated::longhands::border_collapse::computed_value::T
impl Parse for style::properties::generated::longhands::box_sizing::computed_value::T
impl Parse for style::properties::generated::longhands::column_span::computed_value::T
impl Parse for style::properties::generated::longhands::direction::computed_value::T
impl Parse for style::properties::generated::longhands::empty_cells::computed_value::T
impl Parse for style::properties::generated::longhands::flex_direction::computed_value::T
impl Parse for style::properties::generated::longhands::flex_wrap::computed_value::T
impl Parse for style::properties::generated::longhands::font_variant_caps::computed_value::T
impl Parse for style::properties::generated::longhands::list_style_position::computed_value::T
impl Parse for style::properties::generated::longhands::list_style_type::computed_value::T
impl Parse for style::properties::generated::longhands::mix_blend_mode::computed_value::T
impl Parse for style::properties::generated::longhands::object_fit::computed_value::T
impl Parse for style::properties::generated::longhands::position::computed_value::T
impl Parse for style::properties::generated::longhands::table_layout::computed_value::T
impl Parse for style::properties::generated::longhands::text_decoration_style::computed_value::T
impl Parse for style::properties::generated::longhands::text_rendering::computed_value::T
impl Parse for style::properties::generated::longhands::text_wrap_mode::computed_value::T
impl Parse for style::properties::generated::longhands::unicode_bidi::computed_value::T
impl Parse for style::properties::generated::longhands::visibility::computed_value::T
impl Parse for style::properties::generated::longhands::white_space_collapse::computed_value::T
impl Parse for style::properties::generated::longhands::writing_mode::computed_value::T
impl Parse for Inherits
impl Parse for Operator
impl Parse for Orientation
impl Parse for ForcedColors
impl Parse for Scan
impl Parse for MediaDocumentKind
impl Parse for FontPaletteBase
impl Parse for style::values::computed::box_::Clear
impl Parse for style::values::computed::box_::Float
impl Parse for style::values::computed::box_::Resize
impl Parse for GenericFontFamily
impl Parse for SingleFontFamily
impl Parse for Impossible
impl Parse for ArcSize
impl Parse for ArcSweep
impl Parse for ByTo
impl Parse for FillRule
impl Parse for ShapeBox
impl Parse for ShapeGeometryBox
impl Parse for VerticalAlignKeyword
impl Parse for StepPosition
impl Parse for TimingKeyword
impl Parse for GridTemplateComponent<LengthPercentage, Integer>
impl Parse for LineNameListValue<Integer>
impl Parse for TrackBreadth<LengthPercentage>
impl Parse for TrackSize<LengthPercentage>
impl Parse for RepeatCount<Integer>
impl Parse for ShapeExtent
impl Parse for AnchorSizeKeyword
impl Parse for RaySize
impl Parse for PageOrientation
impl Parse for PageSizeOrientation
impl Parse for PaperSize
impl Parse for AnchorSideKeyword
impl Parse for TransformStyle
impl Parse for AnimationComposition
impl Parse for AnimationDirection
impl Parse for AnimationFillMode
impl Parse for AnimationIterationCount
impl Parse for AnimationPlayState
impl Parse for ScrollAxis
impl Parse for Scroller
impl Parse for TransitionBehavior
impl Parse for TransitionProperty
impl Parse for BackgroundRepeatKeyword
impl Parse for BorderImageRepeatKeyword
impl Parse for BorderStyle
impl Parse for LineWidth
impl Parse for Appearance
impl Parse for BaselineSource
impl Parse for BreakBetween
impl Parse for BreakWithin
impl Parse for style::values::specified::box_::Clear
impl Parse for ContainerType
impl Parse for ContentVisibility
impl Parse for style::values::specified::box_::Float
impl Parse for Overflow
impl Parse for OverflowAnchor
impl Parse for OverflowClipBox
impl Parse for OverscrollBehavior
impl Parse for style::values::specified::box_::Resize
impl Parse for ScrollSnapAlignKeyword
impl Parse for ScrollSnapAxis
impl Parse for ScrollSnapStop
impl Parse for ScrollSnapStrictness
impl Parse for Zoom
impl Parse for MathFunction
impl Parse for Color
impl Parse for ForcedColorAdjust
impl Parse for PrintColorAdjust
impl Parse for AngleOrPercentage
impl Parse for NumberOrPercentage
impl Parse for AbsoluteFontWeight
impl Parse for FontFamily
impl Parse for FontSize
impl Parse for FontSizeAdjustFactor
impl Parse for FontSizeKeyword
impl Parse for FontStretch
impl Parse for FontStretchKeyword
impl Parse for style::values::specified::font::FontStyle
impl Parse for FontSynthesis
impl Parse for FontWeight
impl Parse for MathDepth
impl Parse for MetricsOverride
impl Parse for XTextScale
impl Parse for ImageRendering
impl Parse for Length
impl Parse for LengthPercentage
impl Parse for Quotes
impl Parse for CoordBox
impl Parse for OffsetRotateDirection
impl Parse for OutlineStyle
impl Parse for PageName
impl Parse for AnchorScope
impl Parse for GridTemplateAreas
impl Parse for HorizontalPositionKeyword
impl Parse for PositionAnchor
impl Parse for PositionAreaKeyword
impl Parse for PositionTryFallbacksItem
impl Parse for PositionTryFallbacksTryTacticKeyword
impl Parse for PositionTryOrder
impl Parse for VerticalPositionKeyword
impl Parse for SourceSizeOrLength
impl Parse for DProperty
impl Parse for CaptionSide
impl Parse for HyphenateCharacter
impl Parse for LineBreak
impl Parse for MozControlCharacterVisibility
impl Parse for OverflowWrap
impl Parse for RubyPosition
impl Parse for TextAlign
impl Parse for TextAlignKeyword
impl Parse for TextAlignLast
impl Parse for TextDecorationSkipInk
impl Parse for TextEmphasisFillMode
impl Parse for TextEmphasisShapeKeyword
impl Parse for TextEmphasisStyle
impl Parse for TextJustify
impl Parse for TextOverflowSide
impl Parse for WordBreak
impl Parse for TransformBox
impl Parse for CursorKind
impl Parse for Inert
impl Parse for MozTheme
impl Parse for PointerEvents
impl Parse for UserFocus
impl Parse for UserInput
impl Parse for UserModify
impl Parse for UserSelect
impl Parse for ColorInterpolationMethod
impl Parse for AdditiveSymbols
impl Parse for AdditiveTuple
impl Parse for CounterRanges
impl Parse for Fallback
impl Parse for Negative
impl Parse for Pad
impl Parse for Symbols
impl Parse for FontFaceSourceTechFlags
impl Parse for FontStretchRange
impl Parse for FontWeightRange
impl Parse for SourceList
impl Parse for Descriptor
impl Parse for CssUrl
impl Parse for OwnedStr
impl Parse for PairValues
impl Parse for SingleValue
impl Parse for VectorValues
impl Parse for FontPaletteOverrideColor
impl Parse for LayerName
impl Parse for PageSelector
impl Parse for PageSelectors
impl Parse for FamilyName
FamilyName::parse
is based on SingleFontFamily::parse
and not the other
way around because we want the former to exclude generic family keywords.