Skip to content

Conversation

@danielverkamp
Copy link
Contributor

Clean up the API by making invalid device types unrepresentable; APIs that need to represent a potentially failed conversion should use Option or Result instead.

The MMIO transport is modified slightly to read the device ID up front (like the PCI transport).

This also makes it impossible to construct a Transport instance for an unknown/unsupported DeviceType, which seems like a reasonable trade-off to me; it would also be possible to support such a scenario by making Transport::device_type() return Option instead, but that would make the API clunkier to use.

Clean up the API by making invalid device types unrepresentable; APIs
that need to represent a potentially failed conversion should use Option
or Result instead.

The MMIO transport is modified slightly to read the device ID up front
(like the PCI transport).

This also makes it impossible to construct a Transport instance for an
unknown/unsupported DeviceType, which seems like a reasonable trade-off
to me; it would also be possible to support such a scenario by making
Transport::device_type() return Option<DeviceType> instead, but that
would make the API clunkier to use.
@qwandor qwandor merged commit b5c8829 into rcore-os:master Mar 8, 2025
5 checks passed
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.

2 participants