pub trait Parse: Sized {
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
.
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.
Implementations on Foreign Types§
source§impl<T> Parse for Vec<T>where
T: Parse + OneOrMoreSeparated,
<T as OneOrMoreSeparated>::S: Separator,
impl<T> Parse for Vec<T>where
T: Parse + OneOrMoreSeparated,
<T as OneOrMoreSeparated>::S: Separator,
fn parse<'i, 't>(
context: &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 Parse for UnicodeRange
impl Parse for UnicodeRange
fn parse<'i, 't>(
_: &ParserContext<'_>,
input: &mut Parser<'i, 't>
) -> Result<Self, ParseError<'i>>
Implementors§
impl Parse for SpeakAs
impl Parse for Symbol
impl Parse for System
impl Parse for FontDisplay
impl Parse for style::font_face::FontStyle
impl Parse for style::font_face::Source
impl Parse for Qualifier
impl Parse for style::properties::longhands::_servo_overflow_clip_box::computed_value::T
impl Parse for style::properties::longhands::_servo_top_layer::computed_value::T
impl Parse for style::properties::longhands::align_content::computed_value::T
impl Parse for style::properties::longhands::align_items::computed_value::T
impl Parse for style::properties::longhands::align_self::computed_value::T
impl Parse for style::properties::longhands::animation_direction::single_value::computed_value::T
impl Parse for style::properties::longhands::animation_fill_mode::single_value::computed_value::T
impl Parse for style::properties::longhands::animation_play_state::single_value::computed_value::T
impl Parse for style::properties::longhands::backface_visibility::computed_value::T
impl Parse for style::properties::longhands::background_attachment::single_value::computed_value::T
impl Parse for style::properties::longhands::background_clip::single_value::computed_value::T
impl Parse for style::properties::longhands::background_origin::single_value::computed_value::T
impl Parse for style::properties::longhands::border_collapse::computed_value::T
impl Parse for style::properties::longhands::box_sizing::computed_value::T
impl Parse for style::properties::longhands::column_span::computed_value::T
impl Parse for style::properties::longhands::direction::computed_value::T
impl Parse for style::properties::longhands::empty_cells::computed_value::T
impl Parse for style::properties::longhands::flex_direction::computed_value::T
impl Parse for style::properties::longhands::flex_wrap::computed_value::T
impl Parse for style::properties::longhands::font_variant_caps::computed_value::T
impl Parse for style::properties::longhands::justify_content::computed_value::T
impl Parse for style::properties::longhands::list_style_position::computed_value::T
impl Parse for style::properties::longhands::list_style_type::computed_value::T
impl Parse for style::properties::longhands::mix_blend_mode::computed_value::T
impl Parse for style::properties::longhands::pointer_events::computed_value::T
impl Parse for style::properties::longhands::position::computed_value::T
impl Parse for style::properties::longhands::table_layout::computed_value::T
impl Parse for style::properties::longhands::text_decoration_style::computed_value::T
impl Parse for style::properties::longhands::text_rendering::computed_value::T
impl Parse for style::properties::longhands::unicode_bidi::computed_value::T
impl Parse for style::properties::longhands::visibility::computed_value::T
impl Parse for style::properties::longhands::white_space::computed_value::T
impl Parse for style::properties::longhands::writing_mode::computed_value::T
impl Parse for Operator
impl Parse for Orientation
impl Parse for Scan
impl Parse for MediaDocumentKind
impl Parse for ElementOffsetEdge
impl Parse for ScrollDirection
impl Parse for ScrollTimelineOffset
impl Parse for style::stylesheets::scroll_timeline_rule::Source
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 FillRule
impl Parse for ShapeBox
impl Parse for ShapeGeometryBox
impl Parse for VerticalAlignKeyword
impl Parse for ColorSpace
impl Parse for HueInterpolationMethod
impl Parse for StepPosition
impl Parse for TimingKeyword
impl Parse for CounterStyle
impl Parse for SymbolsType
impl Parse for GridTemplateComponent<LengthPercentage, Integer>
impl Parse for TrackBreadth<LengthPercentage>
impl Parse for TrackSize<LengthPercentage>
impl Parse for RepeatCount<Integer>
impl Parse for ShapeExtent
impl Parse for RaySize
impl Parse for PageOrientation
impl Parse for PaperSize
impl Parse for TransformStyle
impl Parse for BackgroundRepeatKeyword
impl Parse for BorderImageRepeatKeyword
impl Parse for BorderSideWidth
impl Parse for BorderStyle
impl Parse for AnimationTimeline
impl Parse for Appearance
impl Parse for BreakBetween
impl Parse for BreakWithin
impl Parse for style::values::specified::box_::Clear
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 ScrollAxis
impl Parse for ScrollSnapAlignKeyword
impl Parse for ScrollSnapAxis
impl Parse for ScrollSnapStop
impl Parse for ScrollSnapStrictness
impl Parse for Scroller
impl Parse for TransitionProperty
impl Parse for MathFunction
impl Parse for Color
impl Parse for PrintColorAdjust
impl Parse for AngleOrPercentage
impl Parse for NumberOrPercentage
impl Parse for AbsoluteFontWeight
impl Parse for FontFamily
impl Parse for FontFeatureSettings
impl Parse for FontLanguageOverride
impl Parse for FontSize
impl Parse for FontSizeAdjust
impl Parse for FontSizeKeyword
impl Parse for FontStretch
impl Parse for FontStretchKeyword
impl Parse for style::values::specified::font::FontStyle
impl Parse for FontVariantAlternates
impl Parse for FontVariantEastAsian
impl Parse for FontVariantLigatures
impl Parse for FontVariantNumeric
impl Parse for FontVariationSettings
impl Parse for FontWeight
impl Parse for MathDepth
impl Parse for MetricsOverride
impl Parse for ImageRendering
impl Parse for Length
impl Parse for LengthPercentage
impl Parse for Quotes
impl Parse for OffsetRotateDirection
impl Parse for OutlineStyle
impl Parse for PageName
impl Parse for GridTemplateAreas
impl Parse for HorizontalPositionKeyword
impl Parse for VerticalPositionKeyword
impl Parse for Resolution
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 TextEmphasisHorizontalWritingModeValue
impl Parse for TextEmphasisShapeKeyword
impl Parse for TextEmphasisStyle
impl Parse for TextEmphasisVerticalWritingModeValue
impl Parse for TextJustify
impl Parse for TextOverflowSide
impl Parse for WordBreak
impl Parse for CursorKind
impl Parse for UserSelect
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 FontStretchRange
impl Parse for FontWeightRange
impl Parse for CssUrl
impl Parse for OwnedStr
impl Parse for PairValues
impl Parse for SingleValue
impl Parse for VectorValues
impl Parse for LayerName
impl Parse for PageSelector
impl Parse for PageSelectors
impl Parse for ElementOffset
impl Parse for ScrollOffsets
impl Parse for ScrollTimelineDescriptors
impl Parse for ScrollTimelineSelector
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.