Trait style::parser::Parse

source ·
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 on function, which needs to fulfill fn(&ParserContext) -> bool.

  • #[parse(parse_fn = "function")] can be used to specify a function other than Parser::parse for a particular variant.

Required Methods§

source

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§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Parse for UnicodeRange

source§

fn parse<'i, 't>( _: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>>

source§

impl<T> Parse for Box<T>
where T: Parse,

source§

fn parse<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>>

source§

impl<T> Parse for Vec<T>

source§

fn parse<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>>

Implementors§

source§

impl Parse for ColorSpace

source§

impl Parse for HueInterpolationMethod

source§

impl Parse for ChannelKeyword

source§

impl Parse for SpeakAs

source§

impl Parse for Symbol

source§

impl Parse for SymbolsType

source§

impl Parse for System

source§

impl Parse for FontDisplay

source§

impl Parse for FontFaceSourceFormatKeyword

source§

impl Parse for style::font_face::FontStyle

source§

impl Parse for Source

source§

impl Parse for Qualifier

source§

impl Parse for style::properties::generated::longhands::_servo_overflow_clip_box::computed_value::T

source§

impl Parse for style::properties::generated::longhands::_servo_top_layer::computed_value::T

source§

impl Parse for style::properties::generated::longhands::backface_visibility::computed_value::T

source§

impl Parse for style::properties::generated::longhands::background_attachment::single_value::computed_value::T

source§

impl Parse for style::properties::generated::longhands::background_clip::single_value::computed_value::T

source§

impl Parse for style::properties::generated::longhands::background_origin::single_value::computed_value::T

source§

impl Parse for style::properties::generated::longhands::border_collapse::computed_value::T

source§

impl Parse for style::properties::generated::longhands::box_sizing::computed_value::T

source§

impl Parse for style::properties::generated::longhands::column_span::computed_value::T

source§

impl Parse for style::properties::generated::longhands::direction::computed_value::T

source§

impl Parse for style::properties::generated::longhands::empty_cells::computed_value::T

source§

impl Parse for style::properties::generated::longhands::flex_direction::computed_value::T

source§

impl Parse for style::properties::generated::longhands::flex_wrap::computed_value::T

source§

impl Parse for style::properties::generated::longhands::font_variant_caps::computed_value::T

source§

impl Parse for style::properties::generated::longhands::list_style_position::computed_value::T

source§

impl Parse for style::properties::generated::longhands::list_style_type::computed_value::T

source§

impl Parse for style::properties::generated::longhands::mix_blend_mode::computed_value::T

source§

impl Parse for style::properties::generated::longhands::object_fit::computed_value::T

source§

impl Parse for style::properties::generated::longhands::position::computed_value::T

source§

impl Parse for style::properties::generated::longhands::table_layout::computed_value::T

source§

impl Parse for style::properties::generated::longhands::text_decoration_style::computed_value::T

source§

impl Parse for style::properties::generated::longhands::text_rendering::computed_value::T

source§

impl Parse for style::properties::generated::longhands::text_wrap_mode::computed_value::T

source§

impl Parse for style::properties::generated::longhands::unicode_bidi::computed_value::T

source§

impl Parse for style::properties::generated::longhands::visibility::computed_value::T

source§

impl Parse for style::properties::generated::longhands::white_space_collapse::computed_value::T

source§

impl Parse for style::properties::generated::longhands::writing_mode::computed_value::T

source§

impl Parse for Inherits

source§

impl Parse for Operator

source§

impl Parse for Orientation

source§

impl Parse for PrefersColorScheme

source§

impl Parse for Scan

source§

impl Parse for MediaDocumentKind

source§

impl Parse for FontPaletteBase

source§

impl Parse for style::values::computed::box_::Resize

source§

impl Parse for GenericFontFamily

source§

impl Parse for SingleFontFamily

source§

impl Parse for Impossible

source§

impl Parse for ArcSize

source§

impl Parse for ArcSweep

source§

impl Parse for ByTo

source§

impl Parse for FillRule

source§

impl Parse for ShapeBox

source§

impl Parse for ShapeGeometryBox

source§

impl Parse for VerticalAlignKeyword

source§

impl Parse for StepPosition

source§

impl Parse for TimingKeyword

source§

impl Parse for GridTemplateComponent<LengthPercentage, Integer>

source§

impl Parse for LineNameListValue<Integer>

source§

impl Parse for TrackBreadth<LengthPercentage>

source§

impl Parse for TrackSize<LengthPercentage>

source§

impl Parse for RepeatCount<Integer>

source§

impl Parse for ShapeExtent

source§

impl Parse for AnchorSizeKeyword

source§

impl Parse for RaySize

source§

impl Parse for PageOrientation

source§

impl Parse for PageSizeOrientation

source§

impl Parse for PaperSize

source§

impl Parse for AnchorSideKeyword

source§

impl Parse for TransformStyle

source§

impl Parse for AnimationComposition

source§

impl Parse for AnimationDirection

source§

impl Parse for AnimationFillMode

source§

impl Parse for AnimationIterationCount

source§

impl Parse for AnimationPlayState

source§

impl Parse for ScrollAxis

source§

impl Parse for Scroller

source§

impl Parse for TransitionBehavior

source§

impl Parse for TransitionProperty

source§

impl Parse for BackgroundRepeatKeyword

source§

impl Parse for BorderImageRepeatKeyword

source§

impl Parse for BorderStyle

source§

impl Parse for LineWidth

source§

impl Parse for Appearance

source§

impl Parse for BaselineSource

source§

impl Parse for BreakBetween

source§

impl Parse for BreakWithin

source§

impl Parse for Clear

source§

impl Parse for ContainerType

source§

impl Parse for ContentVisibility

source§

impl Parse for Float

source§

impl Parse for Overflow

source§

impl Parse for OverflowAnchor

source§

impl Parse for OverflowClipBox

source§

impl Parse for OverscrollBehavior

source§

impl Parse for style::values::specified::box_::Resize

source§

impl Parse for ScrollSnapAlignKeyword

source§

impl Parse for ScrollSnapAxis

source§

impl Parse for ScrollSnapStop

source§

impl Parse for ScrollSnapStrictness

source§

impl Parse for Zoom

source§

impl Parse for MathFunction

source§

impl Parse for Color

source§

impl Parse for ForcedColorAdjust

source§

impl Parse for ForcedColors

source§

impl Parse for PrintColorAdjust

source§

impl Parse for AngleOrPercentage

source§

impl Parse for NumberOrPercentage

source§

impl Parse for AbsoluteFontWeight

source§

impl Parse for FontFamily

source§

impl Parse for FontSize

source§

impl Parse for FontSizeAdjustFactor

source§

impl Parse for FontSizeKeyword

source§

impl Parse for FontStretch

source§

impl Parse for FontStretchKeyword

source§

impl Parse for style::values::specified::font::FontStyle

source§

impl Parse for FontSynthesis

source§

impl Parse for FontWeight

source§

impl Parse for MathDepth

source§

impl Parse for MetricsOverride

source§

impl Parse for XTextScale

source§

impl Parse for ImageRendering

source§

impl Parse for Length

source§

impl Parse for LengthPercentage

source§

impl Parse for Quotes

source§

impl Parse for CoordBox

source§

impl Parse for OffsetRotateDirection

source§

impl Parse for OutlineStyle

source§

impl Parse for PageName

source§

impl Parse for AnchorScope

source§

impl Parse for GridTemplateAreas

source§

impl Parse for HorizontalPositionKeyword

source§

impl Parse for PositionAnchor

source§

impl Parse for PositionAreaKeyword

source§

impl Parse for PositionTryFallbacksItem

source§

impl Parse for PositionTryFallbacksTryTacticKeyword

source§

impl Parse for PositionTryOrder

source§

impl Parse for VerticalPositionKeyword

source§

impl Parse for SourceSizeOrLength

source§

impl Parse for DProperty

source§

impl Parse for CaptionSide

source§

impl Parse for HyphenateCharacter

source§

impl Parse for LineBreak

source§

impl Parse for MozControlCharacterVisibility

source§

impl Parse for OverflowWrap

source§

impl Parse for RubyPosition

source§

impl Parse for Spacing

source§

impl Parse for TextAlign

source§

impl Parse for TextAlignKeyword

source§

impl Parse for TextAlignLast

source§

impl Parse for TextDecorationSkipInk

source§

impl Parse for TextEmphasisFillMode

source§

impl Parse for TextEmphasisShapeKeyword

source§

impl Parse for TextEmphasisStyle

source§

impl Parse for TextJustify

source§

impl Parse for TextOverflowSide

source§

impl Parse for WordBreak

source§

impl Parse for TransformBox

source§

impl Parse for CursorKind

source§

impl Parse for Inert

source§

impl Parse for MozTheme

source§

impl Parse for PointerEvents

source§

impl Parse for UserFocus

source§

impl Parse for UserInput

source§

impl Parse for UserSelect

source§

impl Parse for ColorInterpolationMethod

source§

impl Parse for AdditiveSymbols

source§

impl Parse for AdditiveTuple

source§

impl Parse for CounterRanges

source§

impl Parse for Fallback

source§

impl Parse for Negative

source§

impl Parse for Pad

source§

impl Parse for Symbols

source§

impl Parse for FontFaceSourceTechFlags

source§

impl Parse for FontStretchRange

source§

impl Parse for FontWeightRange

source§

impl Parse for SourceList

source§

impl Parse for Descriptor

source§

impl Parse for CssUrl

source§

impl Parse for OwnedStr

source§

impl Parse for PairValues

source§

impl Parse for SingleValue

source§

impl Parse for VectorValues

source§

impl Parse for FontPaletteOverrideColor

source§

impl Parse for LayerName

source§

impl Parse for PageSelector

source§

impl Parse for PageSelectors

source§

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.

source§

impl Parse for FontLanguageOverride

source§

impl Parse for CoordinatePair<LengthPercentage>

source§

impl Parse for FeatureTagValue<Integer>

source§

impl Parse for FontTag

source§

impl Parse for VariationValue<Number>

source§

impl Parse for GridLine<Integer>

source§

impl Parse for ImplicitGridTracks<TrackSize<LengthPercentage>>

source§

impl Parse for LineNameList<Integer>

source§

impl Parse for NameRepeat<Integer>

source§

impl Parse for TrackList<LengthPercentage, Integer>

source§

impl Parse for GenericPosition<Component<X>, Component<Y>>

source§

impl Parse for AlignContent

source§

impl Parse for AlignItems

source§

impl Parse for AlignSelf

source§

impl Parse for JustifyContent

source§

impl Parse for JustifyItems

source§

impl Parse for JustifySelf

source§

impl Parse for Angle

source§

impl Parse for AnimationName

source§

impl Parse for TimelineName

source§

impl Parse for ViewTransitionName

source§

impl Parse for BackgroundRepeat

source§

impl Parse for BorderImageRepeat

source§

impl Parse for BorderSideWidth

source§

impl Parse for Contain

source§

impl Parse for ContainerName

source§

impl Parse for Display

source§

impl Parse for ScrollSnapAlign

source§

impl Parse for ScrollSnapType

source§

impl Parse for ScrollbarGutter

source§

impl Parse for TouchAction

source§

impl Parse for WillChange

source§

impl Parse for ColorPropertyValue

source§

impl Parse for ColorScheme

source§

impl Parse for NonNegativeFactor

source§

impl Parse for ZeroToOneFactor

source§

impl Parse for FontPalette

source§

impl Parse for FontVariantAlternates

source§

impl Parse for FontVariantEastAsian

source§

impl Parse for FontVariantLigatures

source§

impl Parse for FontVariantNumeric

source§

impl Parse for MozScriptMinSize

source§

impl Parse for MozScriptSizeMultiplier

source§

impl Parse for XLang

source§

impl Parse for OffsetRotate

source§

impl Parse for Percentage

source§

impl Parse for AnchorName

source§

impl Parse for DashedIdentAndOrTryTactic

source§

impl Parse for GridAutoFlow

source§

impl Parse for MasonryAutoFlow

source§

impl Parse for PositionArea

source§

impl Parse for PositionTryFallbacks

source§

impl Parse for PositionTryFallbacksTryTactic

source§

impl Parse for PositionVisibility

source§

impl Parse for TemplateAreas

source§

impl Parse for TemplateAreasArc

source§

impl Parse for Resolution

source§

impl Parse for SourceSize

source§

impl Parse for Attr

source§

impl Parse for Integer

source§

impl Parse for Number

source§

impl Parse for Opacity

source§

impl Parse for MozContextProperties

source§

impl Parse for SVGPaintOrder

source§

impl Parse for VectorEffect

source§

impl Parse for SVGPathData

source§

impl Parse for LetterSpacing

source§

impl Parse for TextDecorationLine

source§

impl Parse for TextEmphasisPosition

source§

impl Parse for TextOverflow

source§

impl Parse for TextTransform

source§

impl Parse for TextUnderlinePosition

source§

impl Parse for WordSpacing

source§

impl Parse for Time

source§

impl Parse for BoolInteger

source§

impl Parse for AtomString

source§

impl Parse for DashedIdent

source§

impl Parse for KeyframesName

source§

impl Parse for InitialValue

source§

impl Parse for AnimationDuration

source§

impl Parse for AnimationTimeline

source§

impl Parse for ViewTimelineInset

source§

impl Parse for BackgroundSize

source§

impl Parse for Circle

source§

impl Parse for ClipPath

source§

impl Parse for Ellipse

source§

impl Parse for InsetRect

source§

impl Parse for Polygon

source§

impl Parse for ShapeCommand

source§

impl Parse for ShapeOutside

source§

impl Parse for BorderCornerRadius

source§

impl Parse for BorderImageSlice

source§

impl Parse for BorderRadius

source§

impl Parse for BorderSpacing

source§

impl Parse for ContainIntrinsicSize

source§

impl Parse for LineClamp

source§

impl Parse for VerticalAlign

source§

impl Parse for CaretColor

source§

impl Parse for Content

source§

impl Parse for CounterIncrement

source§

impl Parse for CounterReset

source§

impl Parse for CounterSet

source§

impl Parse for TimingFunction

source§

impl Parse for BoxShadow

source§

impl Parse for SimpleShadow

source§

impl Parse for Filter

source§

impl Parse for FontSizeAdjust

source§

impl Parse for SpecifiedFontStyle

source§

impl Parse for Gradient

source§

impl Parse for Image

source§

impl Parse for Margin

source§

impl Parse for MaxSize

source§

impl Parse for NonNegativeLength

source§

impl Parse for NonNegativeLengthPercentage

source§

impl Parse for Size

source§

impl Parse for OffsetPath

source§

impl Parse for OffsetPathFunction

source§

impl Parse for RayFunction

source§

impl Parse for PageSize

source§

impl Parse for NonNegativePercentage

source§

impl Parse for AnchorFunction

source§

impl Parse for AspectRatio

source§

impl Parse for Inset

source§

impl Parse for Position

source§

impl Parse for Ratio

source§

impl Parse for SVGLength

source§

impl Parse for SVGStrokeDashArray

source§

impl Parse for SVGWidth

source§

impl Parse for InitialLetter

source§

impl Parse for TextIndent

source§

impl Parse for Rotate

source§

impl Parse for Scale

source§

impl Parse for Transform

source§

impl Parse for TransformOrigin

source§

impl Parse for Translate

source§

impl Parse for ClipRect

source§

impl Parse for GreaterThanOrEqualToOneNumber

source§

impl Parse for NonNegativeInteger

source§

impl Parse for NonNegativeNumber

source§

impl Parse for NonNegativeNumberOrPercentage

source§

impl Parse for PositiveInteger

source§

impl Parse for Cursor

source§

impl Parse for CursorImage

source§

impl Parse for ScrollbarColor

source§

impl<A, B> Parse for Either<A, B>
where A: Parse, B: Parse,

source§

impl<C> Parse for GenericColorOrAuto<C>
where C: Parse,

source§

impl<C> Parse for GenericSVGPaintFallback<C>
where C: Parse,

source§

impl<C, U> Parse for GenericSVGPaintKind<C, U>
where C: Parse, U: Parse,

source§

impl<C: Parse, U: Parse> Parse for SVGPaint<C, U>

source§

impl<H, V> Parse for GenericOffsetPosition<H, V>
where H: Parse, V: Parse, GenericPosition<H, V>: Parse,

source§

impl<I> Parse for GenericZIndex<I>
where I: Parse,

source§

impl<L> Parse for GenericTextDecorationLength<L>
where L: Parse,

source§

impl<L, N> Parse for GenericLengthOrNumber<L, N>
where L: Parse, N: Parse,

source§

impl<LP, N> Parse for GenericBorderImageSideWidth<LP, N>
where LP: Parse, N: Parse,

source§

impl<LengthPercent> Parse for GenericLengthPercentageOrNormal<LengthPercent>
where LengthPercent: Parse,

source§

impl<LengthPercentage> Parse for GenericAnchorSizeFunction<LengthPercentage>
where LengthPercentage: Parse,

source§

impl<LengthPercentage: Parse> Parse for LengthPercentageOrAuto<LengthPercentage>

source§

impl<N, L> Parse for GenericLineHeight<N, L>
where N: Parse, L: Parse,

source§

impl<NonNegativeLength> Parse for GenericPerspective<NonNegativeLength>
where NonNegativeLength: Parse,

source§

impl<NonNegativeLengthPercentage> Parse for GenericShapeRadius<NonNegativeLengthPercentage>
where NonNegativeLengthPercentage: Parse,

source§

impl<OpacityType> Parse for GenericSVGOpacity<OpacityType>
where OpacityType: Parse,

source§

impl<P> Parse for AnchorSide<P>
where P: Parse,

source§

impl<Pos> Parse for GenericPositionOrAuto<Pos>
where Pos: Parse,

source§

impl<PositiveInteger> Parse for GenericColumnCount<PositiveInteger>
where PositiveInteger: Parse,

source§

impl<R> Parse for GenericClipRectOrAuto<R>
where R: Parse,

source§

impl<S> Parse for GenericFlexBasis<S>
where S: Parse,

source§

impl<S> Parse for OriginComponent<S>
where S: Parse,

source§

impl<S: Parse> Parse for PositionComponent<S>

source§

impl<T> Parse for Optional<T>
where T: Parse,

source§

impl<T> Parse for Rect<T>
where T: Clone + Parse,

source§

impl<T: Parse> Parse for FontSettings<T>

source§

impl<U> Parse for GenericUrlOrNone<U>
where U: Parse,