Skip to content

No way to get TokenSerializationType directly #266

Closed
@makotokato

Description

@makotokato

From https://bugzilla.mozilla.org/show_bug.cgi?id=1503656

Actually there is no way to get TokenSerializationType directly from Token type. If it is TokenSerializationTypeVariants::Nothing, it has nothing() function to get it.

Even parsing CSS that is hardcoded value such as 0px, to get type, we have to create Token object like the following.

let token =
    Token::Dimension {
        has_sign: false, value: 0.0, int_value: Some(0), unit: CowRcStr::from("px")
    };
let token_type = token.serialization_type();

I am happy if cssparser has a function to get TokenSerializationType without creating object like TokenSerializationType::nothing().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions