Skip to content

As a user of the library, comparing mime types as strings isn't as optimal as matching enum variants #109

@KSXGitHub

Description

@KSXGitHub

To get specific file types, I have to either call Type::mime_type() or Type::extension(). They both return &'static str which would require string comparison to work with.

Since returning a custom enum is little different from returning string literals/constants, I suggest providing an API to return different mime type enum. There are currently 10 MatcherType, so it makes sense to define 10 new enum types plus 1 to contain all of them.

I don't know if the Rust compiler can optimize comparison of &'static str into simple number comparison, but I'd rather not rely on optimizer magic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions