Skip to content

Replace error types with Unrecognized() variant - #29

Draft
MarijnS95 wants to merge 2 commits into
dzfranklin:mainfrom
MarijnS95:unknown
Draft

Replace error types with Unrecognized() variant#29
MarijnS95 wants to merge 2 commits into
dzfranklin:mainfrom
MarijnS95:unknown

Conversation

@MarijnS95

Copy link
Copy Markdown
Contributor

As #17 (comment) noticed, only DrmModifier has an Unrecognized() variant, which allows more transparently passing around custom or yet-unknown-to-drm-fourcc-rs modifiers. The same seems to apply to DrmFourcc and DrmVendor, where new constants aren't added that infrequently.

By having an Unrecognized() variant users can freely store a DrmFourcc/DrmVendor and pass it around, without treating new values as a failure case.

Important

While just fixing up the tests after initially making the change, I did realize that a value of 0 is invalid, unlike DrmModifier which has a LINEAR variant. Perhaps this is worth keeping the error parser for, and this change should show that rewriting the original error tests for this became awkward.

@MarijnS95

MarijnS95 commented Aug 12, 2025

Copy link
Copy Markdown
Contributor Author

One more advantage is that because fourcc_display_form() isn't public, callers have to write quite a few lines of code to display the four-character code nicely based on DrmFourcc::try_from(), or Debug-print that Result directly. That should no longer be necessary with this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant